Hi,
I need a powershell script to unmanage multiple applications from multiple nodes for a specific time.
I will keep application ID or application name in text file, script should unmanage all those application ID/name mentioned in the text file for a specific time.
Below is the script to unmanage multiple nodes:- We run this script daily from Windows Scheduled Task.
Add-Pssnapin swissnapin
$start = [DateTime]::UtcNow
$end = $start.AddMinutes(60)
$target="localhost"
$swis = Connect-Swis -host $target -UserName xxxx -Password "xxxx"
$IP_Address = Get-Content C:\nodesunmanage.txt
$nodes = Get-SwisData $swis "SELECT Uri FROM Orion.Nodes WHERE IP_Address IN @IP_Address" @{IP_Address=$IP_Address}
$nodes | Set-SwisObject $swis -Properties @{UnmanageFrom=$start;UnmanageUntil=$end}