Discussion:
vb script to monitor process memory usage
(too old to reply)
Dee
2009-10-06 14:58:01 UTC
Permalink
Hi

I want to monitor a particular process for private bytes which I can see is
the amount of memory it is using, however I cannot find the object to use.

I have the below, but it does not give the object i want

any ideas?, thanks

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process")

For Each objProcess in colProcessList
Wscript.Echo "Process: " & objProcess.Name
Wscript.Echo "Process ID: " & objProcess.ProcessID
Wscript.Echo "Thread Count: " & objProcess.ThreadCount
Wscript.Echo "Page File Size: " & objProcess.PageFileUsage
Wscript.Echo "Page Faults: " & objProcess.PageFaults
Wscript.Echo "Working Set Size: " & objProcess.WorkingSetSize
Next
--
Dee
Pegasus [MVP]
2009-10-06 15:35:07 UTC
Permalink
Post by Dee
Hi
I want to monitor a particular process for private bytes which I can see is
the amount of memory it is using, however I cannot find the object to use.
I have the below, but it does not give the object i want
any ideas?, thanks
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery("Select * from
Win32_Process")
For Each objProcess in colProcessList
Wscript.Echo "Process: " & objProcess.Name
Wscript.Echo "Process ID: " & objProcess.ProcessID
Wscript.Echo "Thread Count: " & objProcess.ThreadCount
Wscript.Echo "Page File Size: " & objProcess.PageFileUsage
Wscript.Echo "Page Faults: " & objProcess.PageFaults
Wscript.Echo "Working Set Size: " & objProcess.WorkingSetSize
Next
--
Dee
Hard to say unless you tell us in what way your code fails to deliver.
Dee
2009-10-06 16:55:01 UTC
Permalink
This post might be inappropriate. Click to display it.
Loading...