' Run this script at the command prompt by typing ' cscript procLoad.vbs ' ' MRTG requires 2 numbers to be provided to it, so we are priming Proc1load just in case the target system has only 1 processor proc1load = 101 ' Fetch the target computer name from the command line argument Set objArgs = wscript.Arguments strComputer = objArgs.item(0) ' We use Impersonate here so the WMI query will be run under the context of the user that is running the script ' It is important that your Cron service is starting with sufficient privledges on the TARGET system, otherwise these WMI requests will fail set oSvc = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") wqlQuery = "select LoadPercentage from Win32_Processor where DeviceID = 'CPU0'" ' Fetch the data for Processor0 for each oData in oSvc.ExecQuery(wqlQuery) for each oProperty in oData.Properties_ if oProperty.Name = "LoadPercentage" then proc0Load = oProperty.Value end if next next 'Reset Query for Processor 1 wqlQuery = "select LoadPercentage from Win32_Processor where DeviceID = 'CPU1'" ' Fetch Processor 1 for each oData in oSvc.ExecQuery(wqlQuery) for each oProperty in oData.Properties_ if oProperty.Name = "LoadPercentage" then proc1Load = oProperty.Value end if next next ' Output the results wscript.echo proc0Load wscript.echo proc1Load wscript.echo Date() & " " & Time() wscript.echo "Proc #1 Load" wscript.echo "Proc #2 Load"