Powershell script pulling processor time errors out
So I'm running the following powershell script to monitor processor useage over a five minute interval on multiple servers, and on one of them I get one to four samples before it errors out with the error below.
Get-Counter -Counter “\Processor(_Total)\% Processor Time” -SampleInterval 1 -MaxSamples 300 | Select -ExpandProperty CounterSamples | Select CookedValue | Out-File -Append $loglocation\results-$name-$date.csv
This is occurring on the only 2k8 R2 server in the group being monitored, the script runs fine on 2k3, 2k3 R2, and 2k8 servers. The processor is a Xeon E31230 3.2 GHz. Anyone have any thoughts on why this might be occuring?
Get-Counter : A counter with a negative denominator value was detected. At line:1 char:12
+ get-counter <<<< -counter "\Processor(_Total)\% Processor Time" -sampleinterval 1 -maxsamples 100 | select -expandproperty countersamples | select cookedvalue | Out-File -Append $loglocation\results-$name-$date.csv
+ CategoryInfo : InvalidResult: (:) [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.GetC ounterCommand