I'm trying since few weeks to get CPU Stats from differents Windows server, with PowerShell. I've try the following :
$DataCPU = (Get-Counter $Counter -MaxSamples 20 -ErrorAction SilentlyContinue).countersamples
OR
$Data = @()
$Data1 = (Get-Counter $Counter -ErrorAction SilentlyContinue).countersamples
Start-Sleep -Seconds 10
$Data2 = (Get-Counter $Counter -ErrorAction SilentlyContinue).countersamples
Start-Sleep -Seconds 10
$Data3 = (Get-Counter $Counter -ErrorAction SilentlyContinue).countersamples
Start-Sleep -Seconds 10
$Data4 = (Get-Counter $Counter -ErrorAction SilentlyContinue).countersamples
$DataCPU = $Data + $Data1 + $Data2 + $Data3 + $Data4
On both, i'm facing on different servers, strange value, like :
"Path": "\\\\xxx-xxxxx\\process(chrome#91)\\% processor time", "InstanceName": "chrome", "CookedValue": 1353.6754699664537, "RawValue": 152656250, "SecondValue": 132475929754152508, "MultipleCount": 1, "CounterType": 542180608, "Timestamp": "\/Date(1603119375415)\/", "Timestamp100NSec": 132476001754150000, "Status": 0, "DefaultScale": 0, "TimeBase": 10000000
Server has 4 VCpu, value should not be more than 400 ?