I am working on a script that I can fee a list of servers to and unmanage the servers.
I can get all the moving parts to work, but when it comes to the actual invoke-swisverb the script tanks.
Here is what I have:
$FilePath = Read-Host -Prompt "Input file path to list"
$silenceTime = Read-Host -Prompt "Enter time to silence Servers"
ForEach ($nodename in (Get-Content -Path $filePath)){
Write-Host $nodename
$swis = Connect-Swis -Credential $cred -host $orionservername
$nodeid = Get-SwisData $swis "SELECT NodeID FROM Orion.Nodes WHERE SysName LIKE '$nodename%'"
$now =[DateTime]::UtcNow
$later =$now.AddMinutes($silenceTime)
Invoke-SwisVerb $swis Orion.Nodes Unmanage @("$nodeid", $now ,$later, "false")
}