I had a previous post which I can't edit for some reason.
in any case, can someone help me modify the following script I found on the forums to mute nodes instead of unmanaging them?
I want the ability to pass the duration(hours) thru the execution of the script.
# Hours passed when running script e.g (./unmanage.ps1 12) will set maintance for 12 hours
$hours=$args[0]
# Where is the server file located (file is a text file with just server names not FQDN)
$serverlist = Get-Content C:\servers.txt
# For each time you look at a line in the text file above do this >>>>>
foreach($server in $serverlist){
$strQuery = "SELECT uri FROM Orion.Nodes WHERE SysName LIKE '" + "$server" + "%'"
$uris = Get-SwisData $swis $strQuery
# Important line where we actually set the server to unmanaged and status 9 and then set it to maintance from when script was run to the hours we said at start
$uris | ForEach-Object { Set-SwisObject $swis $_ @{Status=9;Unmanaged=$true;UnmanageFrom=[DateTime]::UtcNow;UnmanageUntil=[DateTime]::UtcNow.AddHours($hours)}}
}