Problem:
I am having figuring out how to use WMI to determine the CPU Time of a process. Does anyone know how this can be accomplished?
Contributed by Rob Olson
This should do it...
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery _
("Select * from Win32_process")
For Each objProcess in colProcesses
sngProcessTime = ( CSng(objProcess.KernelModeTime) + _
CSng(objProcess.UserModeTime)) / 10000000
Wscript.echo objProcess.name & VbTab & sngProcessTime
Next