Dim oAPI, oBag, ServiceInstalled
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Service WHERE
Name = 'SpntSvc'",,48)
For Each objItem in colItems
ServiceInstalled = 1
Next
If ServiceInstalled = 1 Then
Call oBag.AddValue("State","GOOD")
Call oAPI.Return(oBag)
wscript.quit()
Else
Call oBag.AddValue("State","BAD")
Call oAPI.Return(oBag)
wscript.quit()
End If
I put this script in a Time Script Two State monitor and added the following
expressions:
Unhealthy: Property(@Name='State') Contains BAD
Healthy: Property(@Name='State') Contains GOOD
However at the monitored servers I get the Error:
The Microsoft Operations Manager Expression Filter Module failed to query
the delivered item, item was dropped.
Property Expression: Property(@Name='State')
I tried several other Expressions but I can't get it to work. What I'm doing
wrong?
If you instead use the management pack template to look at a windows service
it will self discover all machines with the ServerProtect service and start
protect them.
Anders Bengtsson
Microsoft MVP - System Center Operations Manager
www.contoso.se
> ServerProtect
>
You need to use [ ], take a look at http://contoso.se/blog/?p=305
Thx.