fortypoundhead.com

List Running Processes with VBScript

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


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 21 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:54.81.45.122

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




Recent Forum Posts

Advanced search added
dwirch posted on September 23, 2017 at about 13:44 in Site News

Job Spammer: Gaurav Mehta - AgreeYa Solutions
dwirch posted on September 22, 2017 at about 10:35 in Spammers

Job Spammer: Prutha Siri - Javelin Systems
dwirch posted on September 10, 2017 at about 6:15 in Spammers

New security implemented
dwirch posted on September 7, 2017 at about 7:16 in Site News

Malicious IP Checker Companion Tool
dwirch posted on August 12, 2017 at about 20:24 in Site News

Job Spammer: Steve Adams
dwirch posted on August 8, 2017 at about 7:44 in Spammers