Hello All,
I have the script below which works great for scheduling nodes for unmanage. Is there any way to configure this script not to unmanage nodes, but to mute the alerts?
# 2017-03-29 Node Scheduled Unmanage script for SolarWinds SDK Powershell
#Instructions:Configure the Start and End times. Edit the nodelist.txt file to include all of the servers that need
#the alerts muted for the scheduled change times.
#Region PSSnapin presence check/add
#Silently Call SolarWinds SDK
if (!(Get-PSSnapin -Name "SwisSnapin" -ErrorAction SilentlyContinue))
{
Add-PSSnapin SwisSnapin -ErrorAction SilentlyContinue
}
#EndRegion
$OrionServer = 'ServerName'
GET-CREDENTIAL –Credential abc\ServiceAccount | EXPORT-CLIXML C:\Users\kbryant\Desktop\Powershell\SecureCredentials.xml
$MyCredentials=IMPORT-CLIXML C:\Users\kbryant\Desktop\Powershell\SecureCredentials.xml
$swis = Connect-Swis -Hostname $OrionServer -Credential $MyCredentials
write-host "Sample - Date:'2019-05-22 05:45:00 PM'" -ForegroundColor Red -BackgroundColor Black
[datetime]$start = Read-Host "enter date and time to mute alerts" -ForegroundColor Red -BackgroundColor Black
write-host "Sample - Date:'2019-05-22 06:30:00 PM'" -ForegroundColor Green -BackgroundColor Black
[datetime]$end = Read-Host "enter date and time to end alert muting" -ForegroundColor Green -BackgroundColor Black
Get-SwisData $swis "SELECT Uri FROM Orion.Nodes WHERE Caption IN @captions" @{captions=(Get-Content c:\temp\nodelist.txt)} | Set-SwisObject $swis -Properties @{UnmanageFrom=$start.ToUniversalTime();UnmanageUntil=$end.ToUniversalTime()}