WMI sample: checks if a process is running on a (remote) computer. Uses win32_process WMI class.
WMI sample: checks if a process is running on a (remote) computer. Uses win32_process WMI class.
Rate WMI sample: checks if a process is running on a (remote) computer. Uses win32_process WMI class.
(3(3 Vote))
' This function checks if a process is running on a (remote) computer
' Requires WMI
' Check out http://www.activexperts.com for more samples and components
Function IsProcessRunning( strServer, strProcess )
Dim Process, strObject
IsProcessRunning = False
strObject = "winmgmts://" & strServer
For Each Process in GetObject( strObject ).InstancesOf( "win32_process" )
If UCase( Process.name ) = UCase( strProcess ) Then
IsProcessRunning = True
Exit Function
End If
Next
End Function
' Main
Dim strComputer, strProcess
Do
strProcess = inputbox( "Please enter the name of the process (for instance: explorer.exe)", "Input" )
Loop until strProcess <> ""
Do
strComputer = inputbox( "Please enter the computer name", "Input" )
Loop until strComputer <> ""
If( IsProcessRunning( strComputer, strProcess ) = True ) Then
WScript.Echo "Process " & strProcess & " is running on computer " & strComputer
Else
WScript.Echo "Process " & strProcess & " is NOT running on computer " & strComputer
End If
WMI sample: checks if a process is running on a (remote) computer. Uses win32_process WMI class. Comments
No comments yet — be the first to post one!
Post a Comment