-
-
Save crshnbrn66/f9779247e5b3dc8709aa2f72b51095aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tasks2add = $tasks = $null | |
$taskjson = @' | |
[ | |
{ | |
"taskId": "1", | |
"name": "Server-Scommaintenance", | |
"enabled": false, | |
"inputs": { | |
"servers": "$(serverMonitors) ", | |
"webMonitors": "$(webMonitors)", | |
"MinuteValue": "2000", | |
"maintValue": "inMaint" | |
} | |
}, | |
{ | |
"taskId": "2", | |
"name": "Server-Scommaintenance", | |
"enabled": false, | |
"inputs": { | |
"servers": "$(serverMonitors) ", | |
"webMonitors": "$(webMonitors)", | |
"emailusers": "$(ScomNotify)", | |
"MinuteValue": "2000", | |
"maintValue": "RemoveMaint" | |
} | |
} | |
] | |
'@ | |
$tasks2add = $taskjson|convertfrom-json | |
$newArraylist = new-object System.Collections.Generic.List[system.object] | |
$newArraylist.Add((New-object pscustomobject ($tasks2add[0]))) | |
$newArraylist.Add((New-object pscustomobject ($tasks2add[1]))) | |
$newArraylist.Add((New-object pscustomobject ($tasks2add[0]))) | |
$newArraylist.Add((New-object pscustomobject ($tasks2add[1]))) | |
#$newArraylist.count | |
$newArraylist[0].enabled = $true | |
$newArraylist[1].enabled = $false | |
$newArraylist[2].enabled = $false | |
$newArraylist[3].enabled = $true | |
$newArraylist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment