Questions about script to check performance.
Hi,
I need to make a script to check the processor percentage, process, process id, page file size and working set size and at the end i need it to output the results into a text file.
I′ve already started to make the script :
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 "Time: " & Now
Wscript.Echo "Process: " & objProcess.Name
'Wscript.Echo "Process ID: " & objProcess.ProcessID
'Wscript.Echo "Page File Size: " & objProcess.PageFileUsage
'Wscript.Echo "Working Set Size: " & objProcess.WorkingSetSize
Set PerfProcess = objWMIService.Get("Win32_PerfFormattedData_PerfProc_Process.Name='taskmgr'")
PerfProcess.Refresh_
Wscript.Echo PerfProcess.PercentProcessorTime
Next
But i′m not getting the values of the cpu % of the process.
Can anyone help me solving this question?
Regards,
Ricardo

