Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 22513

Re: Re: Third Party Application Acknowledge SolarWinds Event

$
0
0

I'm not sure why that is not working, you can do the following for now.

 

if (!(Get-PSSnapin -Name "SwisSnapin" -ErrorAction SilentlyContinue))
{  Add-PSSnapin SwisSnapin -ErrorAction SilentlyContinue
}

$swisTarget = 'localhost'
$username="admin"
$password=""


$swis = Connect-Swis -host $swisTarget -UserName $username -Password $password

#Get the first alert that isn't acknowledged
$query = "SELECT TOP 1 AlertDefID AS DefinitionId, ActiveObject AS ObjectId, ObjectType FROM Orion.AlertStatus WHERE Acknowledged = 0"

$queryResult = Get-SwisData $swis $query

ForEach ($ActiveAlert in $queryResult)
{
  [xml]$invokeResult    $invokeResult = Invoke-SwisVerb $swis "Orion.AlertStatus" "Acknowledge" @(([xml]@(       "<ArrayOfAlerto xmlns='http://schemas.solarwinds.com/2008/Orion'>",       [string](%{         "<AlertInfo><DefinitionId>$($ActiveAlert.DefinitionId)</DefinitionId><ObjectType>$($ActiveAlert.ObjectType)</ObjectType><ObjectId>$($ActiveAlert.ObjectId)</ObjectId></AlertInfo>"         }       ),       "</ArrayOfAlertInfo>"    )).DocumentElement)  $result = $invokeResult.ChildNodes.Value  Write-Host "Acknowledge events returned $result"
}

Viewing all articles
Browse latest Browse all 22513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>