Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

win32 process memory usage

540 views
Skip to first unread message

Michael Wimmer

unread,
Feb 23, 2005, 7:25:31 AM2/23/05
to
Hi

is there a way to read the used memory from a process I get via
oWmi.ExecQuery ("select ... from Win32_process ...")?

I would like to read the figures as shown under memory usage in the
process list of the task manager.

Best regards,

Michael

Lee Peedin

unread,
Feb 23, 2005, 8:00:36 AM2/23/05
to
Good question Michael,
I've been toying with the following script, but have never been able
to directly relate the information from it directly to what is seen in
the task manager. Maybe someone else here can provide insight to
"both" of us.

Lee

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

Michael Wimmer

unread,
Feb 23, 2005, 8:18:53 AM2/23/05
to
Hi Lee,

WorkingSetSize looks good. If I devide it by 1024 I get the same number
as show in task manager.

Thanks a lot,

Michael

0 new messages