Q: How can I check for a process by using VBScript?

This script scans all running processes.

John Savill

September 8, 2011

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A: The script below checks for a given process and reports if it’s running by scanning through all running processes.

Replace the procName “winword.exe” with the image you wish to check for and replace the logic if the process is found with your own requirements.

set objWMIService = GetObject ("winmgmts:")foundProc = FalseprocName = "winword.exe"procNameFriend = "Word"for each Process in objWMIService.InstancesOf ("Win32_Process")    If StrComp(Process.Name,procName,vbTextCompare) = 0 then        foundProc = true    End IfNextIf foundProc = True Then    WScript.Echo "Found Process"End If

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like