$listOfAlerts = Get-SCOMClass -DisplayName 'Storage Center' | Get-SCOMClassInstance | Get-SCOMAlert -ResolutionState 249
if ($listOfAlerts.Count -ne 0)
{
foreach ( $scomAlert in $listOfAlerts)
{
# extract the InstanceId of the alert
[xml]$alertXml = $scomAlert.Context
$alertXml.DataItem.Property | % {if ($_.Name -eq "InstanceId") {$id = $_.InnerText} }
# Get the Alert object from EM
$emalertobj = Get-WmiObject -ComputerName $scomAlert.PrincipalName -Namespace "root\Dell\Storage" -Class "Dell_StorageCenterAlert" -Filter "InstanceId = '$id'"
# if it is not acknowledged, call AckAlert
if (($emalertobj -ne $null) -and ($emalertobj.Acknowledged -eq $False))
{
# Alert is not acknowledged in EM; do the same
Invoke-WmiMethod -ComputerName $scomAlert.PrincipalName -Namespace "root\Dell\Storage" -Class "Dell_StorageCenterAlert" -Name "AckAlert" -ArgumentList $id,$null
}
}#end of for each
}</Script></ScriptBody>
<Parameters/>
<TimeoutSeconds>300</TimeoutSeconds>
</WriteAction>
</WriteActions>
</Rule>