Create a “Timed Script 2 State Monitor”.

Set your target as “Windows Server 2003”. Set the Monitor to disabled.

Use this script below (Set the processname = to the process you want to monitor)

————————————————-

On Error Resume Next

Dim oAPI, oBag
Set oAPI = CreateObject(“MOM.ScriptAPI”)Set oBag = oAPI.CreateTypedPropertyBag(StateDataType)

strComputer = “.”processname = “AeXNSAgent.exe” ‘Process name here

Set objWMIService = GetObject(“winmgmts:” _ & “{impersonationLevel=impersonate}!\\” &
strComputer & “\root\cimv2”)

strQuery = “Select * from Win32_Process Where Name = ‘” & ProcessName & “‘”Set colProcesses = objWMIService.ExecQuery (strQuery)

If colProcesses.Count = 0 Then

Call oBag.AddValue(“State”,”BAD”)Else Call oBag.AddValue(“State”,”GOOD”)

End If

Call oAPI.Return(oBag)

Categories:

Tags:

2 Responses

Leave a Reply

Your email address will not be published. Required fields are marked *