This script writes processor time and memory use for each running process on the system into a CSV file.
VBSTART
Sub DumpProcInfo(OutFile)
'Writes ProcessorTime and VirtualBytes (memory use) for each running process to file
'See: http://msdn.microsoft.com/library/defau ... rocess.asp
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery("Select * from Win32_PerfFormattedData_PerfProc_Process",,48)
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.CreateTextFile(OutFile, True)
filetxt.WriteLine("ProcessName,PercentProcessorTime,VirtualBytes")
For Each objItem in colProcess
if objItem.Name "Idle" and objItem.Name "_Total" then
filetxt.WriteLine(objItem.Name & "," & objItem.PercentProcessorTime & "," & objItem.VirtualBytes)
end if
Next
filetxt.Close
End Sub
VBEND
VBRun>DumpProcInfo,c:\procusage.txt
Output CPU and memory use for each process
Moderators: Dorian (MJT support), JRL, Phil Pendlebury
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Output CPU and memory use for each process
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?