List Running Processes with VBScript
This quick chunk of demo code shows you how to get a list of running processes on the local machine with VBScript, via WMI.
First, why am I posting what appear to be completely old scripts from the days of yore? Believe it or not, there are still a lot of folks out there who still rely on systems that don't have such nifty things as PowerShell. These legacy systems still need support, and I don't want to see those people left high and dry as resources disappear.
This is another straightforward script. Using WMI, we can get a list of running processes. For this example, we are only querying the local workstation. But if you look closely at the script below, you'll note how easy it would be to modify for looking at processes running on remote workstations. You could conceivably get a list of processes on machine B from machine A, and even stop/start those processes. All remotely.
Option Explicit
Dim objWMIService, objProcess, colProcess
Dim strComputer, strList
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process")
For Each objProcess in colProcess
strList = strList & vbCr & objProcess.Name
Next
WSCript.Echo strList
About this post
Posted: 2017-09-20
By: vb6boy
Viewed: 4,857 times
Categories
Visual Basic Script (VBS)
Windows
Attachments
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.