Active Process check
Brought to you by:
vittoriop77
Adding the ability to look for an active running process
by name would be a great addition to this package. I
know in some cases there are applications running on
servers that are vital and not installed as a service.
I can think of one such instance where we are runing a
file syncronization utility that has to stay up and at
times crashes - be nice to know when it does.
Thanks!
Logged In: YES
user_id=1313445
'
***************************************************************
' * CheckProgs.vbs *
' * By Wayne Mery *
' * adapted from
healthmonitor\customscripts\CheckNumOfProcesses.vbs *
' * By Vittorio Pavesi (www.vittorio.tk) *
' * *
' * Check for programs running *
'
***************************************************************
CheckProc(70)
Sub CheckProc(MaxProcN)
Set Proc1 =
GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_process")
ProcN = 0
lpdFND = 0
hsFND = 0
for each Process in Proc1
' *** Note: check for Process.Name is CASE SeNsItIvE !
' WScript.Echo Process.Name
if Process.Name = "HostServe.exe" then
hsFND = 1
else if Process.Name = "lpd.exe" then
lpdFND = 1
else if Process.Name = "LPD.exe" then
lpdFND = 1
end if
end if
end if
ProcN = ProcN +1
Next
if hsFND = 1 and lpdFND = 1 then
WScript.Echo "OK"
else
if ProcN > MaxProcN then
WScript.Echo "Error - process count overflow max=" &
MaxProcN
else
WScript.Echo "Error - lpd.exe or hostserve.exe or
both are down. Note: number processes=" &ProcN
end if
end if
End sub
use in good health