' Windows Management Instrumentation newscript dim objLocator = CreateObject("WbemScripting.SWbemLocator") IF istype(objLocator) == "ERROR" Then message ="Failed at: objLocator" STOP END If ' ---------------------------------- ' Log on to the namespace ' If you do not specify a computer in the call to ConnectServer then WMI connects to the local computer. dim strServer = "." ' If you do not specify a namespace then WMI connects to the namespace specified in the registry key. dim strNamespace = "root\cimv2" dim objService = objLocator.ConnectServer(strServer, strNamespace) IF istype(objService) == "ERROR" Then message ="Failed at: objService" STOP END If ' ---------------------------------- ' create a query for the target information ' here are 3 examples. select the one you want: dim example = 3 IF example == 1 then dim ProcessID = 4 ' use a process id that is valid on your machine dim Query = "Select * from Win32_PerfRawData_PerfProc_Process Where IDProcess = " & ProcessID ELSEIF example == 2 then dim Query = "Select * from Win32_PerfRawData_PerfProc_Process " ELSE dim Query = "Select * from Win32_Processor " END If ' ---------------------------------- ' submit the query dim objQueryResults = objService.ExecQuery(Query) IF istype(objQueryResults) == "ERROR" Then message ="Failed at: objQueryResults" STOP END If IF ! objQueryResults.Count Then message ="Failed at: objQueryResults.Count" STOP END If ' ---------------------------------- ' display the query response dim objProp ' set the range of the results rows to be handled dim lowerIndex = 0 dim UpperIndex = 2 IF objQueryResults.Count > 1 then UpperIndex = 1 ELSEIF objQueryResults.Count = 1 THen UpperIndex = 0 ELSE UpperIndex = -1 END IF dim i dim objResult FOR I = lowerIndex to UpperIndex objResult = objQueryResults.ItemIndex(i) freestring = "result row : " & I & chr(0x0a) WITH objResult FOR Each objProp In .Properties_ ' careful this name really is terminated with an underscore character! WITH objProp freestring = freestring & Padder ( .CIMType, 0 , 3) & " " & .Name & ": " & .Value & chr(0x0a) END with NEXT objProp END With message = freestring NEXT i