I need to be able to monitor cpu utilization on a process (setup.exe) so that I can reboot the system if the "sngProcessTime is <0.5" for 2 minutes. The script below calls a Reboot sub if the "sngProcessTime is <0.5" at the interval in the outer For-Next loop.
The reason for this is we have a video driver update (setup.exe) that tends to just sit there even after the installation is complete.
How can this be modified to perform the action: Call Reboot if "sngProcessTime is <0.5 for a period of 2 minutes"?
Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process Where Name = 'Setup.exe'")
For i = 1 to 10
For Each objProcess In colProcesses
sngProcessTime = ( CSng(objProcess.KernelModeTime) + _
CSng(objProcess.UserModeTime)) / 10000000
If sngProcessTime < 0.5 Then