Hello, we have a two state monitor and I would like to channel the Alert Context to Alert Description.
The powershell script being used to find the stopped services is pasted below:
$API = new-object -comObject "MOM.ScriptAPI"
$bag = $api.CreatePropertyBag()
$ServiceStatus = Get-WmiObject -class win32_service |where {$_.startmode -eq'Auto'-and $_.State -eq 'Stopped' -and
$_.name -ne 'wuauserv'}
if (!$ServiceStatus) #if there are no automatic services that are stopped, we are healthy.
{
write-host "good"
$bag.addvalue("State","good")
}
if ($servicestatus) #if there are any automatic services that are stopped, we are unhealthy.
{
write-host "bad"
$bag.addvalue("State","bad")
foreach ($service in $servicestatus) #enumerate the stopped services
{
$bag.addValue("$($Service.Name):","$($Service.state)")
}
}
$bag
$API.Return($BAG)
The results of the services that are stopped are being captured in the Alert Context”. How can I pipe the Alert Context to “Alert Description” to obtain a meaningful alert?
Alert Context data:
Property Name Property Value
State bad
clr_optimization_v4.0.30319_32: Stopped
clr_optimization_v4.0.30319_64: Stopped
How can I pipe to Alert Description in SCOM 2012?
Thanks,
Kapil Dham
Kapil Dham