Need help for the alert suppression for the interface, I have got below script but it seems not working?
$hostname = 'hostname'
$user = "user"
$password = "Password"
# Connect to SolarWinds
$swis = Connect-Swis -HostName $hostname -Username $user -Password $password -IgnoreSSLErrors
# Set device and interface details
$nodeName = "nodename"
$interfaceName = "GigabitEthernet0/0" # or "Gi0/0", depending on how it's named in SolarWinds
# Query to fetch the interface URI
$query = @"
SELECT i.InterfaceID, i.Uri, i.InterfaceName, n.Caption
FROM Orion.NPM.Interfaces i
JOIN Orion.Nodes n ON i.NodeID = n.NodeID
WHERE n.Caption = '$nodeName' AND (i.InterfaceName = '$interfaceName' OR i.InterfaceName = 'Gi0/0')
$Interfaces = Get-SwisData $swis $query
if ($Interfaces.Count -eq 0) {
Write-Host "No matching interfaces found for $interfaceName on $nodeName"
exit
}
# Set mute times (adjust as needed)
$now = [DateTime]::UtcNow.AddHours(1)
$later = [DateTime]::UtcNow.AddHours(6)
foreach ($iface in $Interfaces) {
Write-Output "Muting alerts for $($iface.InterfaceName) on $($iface.Caption) from $now to $later"
# Suppress alerts – valid for interfaces only
Invoke-SwisVerb $swis Orion.AlertSuppression SuppressAlerts @($iface.Uri, $now, $later) | Out-Null
}