List running processes


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'===========================================================
'
' NAME: <listRunningProcesses.vbs>

' COMMENT: <lists information on running processes on system>
'
'===========================================================
Option Explicit
'On Error Resume Next
dim strComputer   'computer to connect to with wmi
dim wmiNS         'wmi namespace
dim wmiQuery      'the wmi query
dim objWMIService 'connection using wmi moniker
dim colItems      'collection of wmi objects
Dim objItem       'individual item in the collection
Dim strProperties 'properties to choose
Dim strValues     'string of wmi values

strComputer = "."
wmiNS = "\root\cimv2"
strProperties = "name,processID,pageFaults,WorkingSetSize"
wmiQuery = "Select " & strProperties & " from win32_process" &_
  " where processID <>0"

Set objWMIService = GetObject("winmgmts:\\" & strComputer & wmiNS)
Set colItems = objWMIService.ExecQuery(wmiQuery)

For Each objItem in colItems
  With objItem
    strValues = .name & "," & .processID & "," &_
     .PageFaults & "," & .WorkingSetSize
  End With
  WScript.Echo strValues
Next



You can leave a response, or trackback from your own site.


Further Reading
    None Found




Leave a Reply

Anti-Spam Quiz:

Twitter Delicious Facebook Digg Stumbleupon Favorites More
335 queries in 3.759 seconds.