Below is the script to check the CPU utilization for every
process running on a server
Save this as a .vbs file and then run it using cscript.
Set colProcesses = objWMIService.ExecQuery _
Save this as a .vbs file and then run it using cscript.
strComputer = "localhost"
Set objWMIService = GetObject("winmgmts:" _
&
"{impersonationLevel=impersonate}!\\" _
& strComputer
& "\root\cimv2")
("Select *
from Win32_Process")
For Each objProcess in colProcesses
Wscript.Echo
"Process: " & objProcess.Name
sngProcessTime =
(CSng(objProcess.KernelModeTime) + _
CSng(objProcess.UserModeTime)) / 10000000
Wscript.Echo
"Processor Time: " & sngProcessTime
Wscript.Echo
"Process ID: " & objProcess.ProcessID
Wscript.Echo
"Working Set Size: " _
&
objProcess.WorkingSetSize
Wscript.Echo
"Page File Size: " _
&
objProcess.PageFileUsage
Wscript.Echo
"Page Faults: " & objProcess.PageFaults
Next
No comments:
Post a Comment