Using Kixtart 4.22 on an XP test machine, going off of information from here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnclinic/html/scripting11182003.asp
Trying to create a Kixtart/WMI processor performance monitor, here's the Code:
 $strComputer = "."
$objWMIService = GetObject("winmgmts:\\" + $strComputer + "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * From Win32_PerfRawData_PerfOS_Processor Where Name = '0'")
For Each $objItem in $colItems
$CounterValue1 = $objItem.PercentUserTime
$TimeValue1 = $objItem.TimeStamp_Sys100NS
Next
For $i = 1 to 5
Sleep 1
$colItems = $objWMIService.ExecQuery("Select * From Win32_PerfRawData_PerfOS_Processor Where Name = '0'")
For Each $objItem in $colItems
$CounterValue2 = $objItem.PercentUserTime
$TimeValue2 = $objItem.TimeStamp_Sys100NS
If $TimeValue2 - $TimeValue1 = 0
? "Percent User Time = 0%"
Else
$PercentProcessorTime = 100 * ($CounterValue2 - $CounterValue1) / ($TimeValue2 - $TimeValue1)
? "Percent User Time = " + $PercentProcessorTime + "%"
Endif
$CounterValue1 = $CounterValue2
$TimeValue1 = $TimeValue2
Next
Next


Keep getting an "ERROR : Error in experssion.!" on the line that has "If $TimeValue2 - $TimeValue1 = 0" on it.
I put a "? $TimeValue1" and "? $TimeValue2" line in after each of those variables to see what they were returning. I got 4230585452000 for $TimeValue1 and 4230595588000 for $TimeValue2. Set up a seperate script to see if it just didn't like the math on those numbers... had no problem with it, it just doesn't want to work when it gets the numbers from a WMI query.

Any ideas?