The script check the CPU usage under windows:
CPU_Percentage = 70 Function cpu_check() strComputer = "." strQuery = "select * from Win32_PerfFormattedData_PerfOS_Processor" Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set Item = objWMIService.ExecQuery(strQuery,,48) For Each Proc In Item If Proc.Name = "_Total" Then CPU_Usage = Proc.PercentProcessorTime End If Next If int(CPU_Usage) > int(CPU_Percentage) Then MsgBox(CPU_Usage) End If End Function |