View Alerts in Powershell Grid Widget
SCOM 2012 R2 UR2 come with new Widget named 'Powershell Grid' widget
in this post you will learn how to view specific alerts in this widget by using simple Powershell script,
1. write the script.
2. build the grid template commands.
3. create new dashboard select Powershell grid widget, and insert the script with grid commands.
Example:
--------------------------------------------------------------------------------------
$Alerts = Get-SCOMAlert -ResolutionState 0
Foreach ($Alert in $Alerts)
{
$DataObject = $ScriptContext.CreateInstance("xsd://foo!bar/baz")
$DataObject["Id"] = [String]($Alert.id)
$DataObject["Name"] = [String]($Alert.Name)
$DataObject["Severity"] = [String]($Alert.Severity)
$ScriptContext.ReturnCollection.Add($DataObject)
}
--------------------------------------------------------------------------------------
Script in Widget:
4. Result!
you can insert more alerts fields to widget, by adding more $DataObject["<Alert Field>"] = [String]($Alert.<Alert Field>) to final script