by Anonymous (267 Submissions)
Category: Windows System Services
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sun 4th May 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
WMI sample: checks if a process is running on a (remote) computer. Uses win32_process WMI class.
' 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
No comments have been posted about WMI sample: checks if a process is running on a (remote) computer. Uses win32_process WMI class.. Why not be the first to post a comment about WMI sample: checks if a process is running on a (remote) computer. Uses win32_process WMI class..