OPTION EXPLICIT
DIM strComputer,strProcess
strComputer = "."
strProcess = "wrapper.exe"
' Check if Wrapper is running on specified computer
IF isProcessRunning(strComputer,strProcess) THEN
wscript.echo strProcess & " is running on computer '" & strComputer & "'"
ELSE
wscript.echo strProcess & " is NOT running on computer '" & strComputer & "'"
END IF
FUNCTION isProcessRunning(BYVAL strComputer,BYVAL strProcessName)
DIM objWMIService, strWMIQuery
strWMIQuery = "Select * from Win32_Process where name like '" & strProcessName & "'"
SET objWMIService = GETOBJECT("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
IF objWMIService.ExecQuery(strWMIQuery).Count > 0 THEN
isProcessRunning = TRUE
ELSE
isProcessRunning = FALSE
END IF
END FUNCTION
留言
張貼留言