fortypoundhead.com

List Running Processes with VBScript

Posted On 2017-09-20 by VB6Boy
Keywords:
Tags: VBScript Windows
Views: 94


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 the Author

VB6Boy has posted a total of 22 articles.


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:107.20.115.174

Before you can post, you need to prove you are human. If you log in, this test goes away.




Quick Links