Hi,
I am trying to create some solution for performance monitoring and facing some strange behavior of Export-counter.
I am doing following:
$counterLIst=((get-counter -listset Processor).PathsWithInstances | Where-Object {$_ -like "*Processor*" -and $_ -notlike "*Network*" -and $_ -notlike "*Thread*" -and ( $_ -like "* Processor Time*" -or $_ -like "*Interrupts/sec*" )})
It gives me Processors counter list, that includes all the instances. Till than it is ok…
I am able to view samples by:
Get-counter -Counter $counterLIst -SampleInterval 2 -MaxSamples 5
And it is also working properly .
But (!!!) when I am trying to export counters by:
Get-counter -Counter $counterLIst -SampleInterval 2 -MaxSamples 5 | Export-counter -Force -Path C:\Test.blg
It gives me only the Totals, without the instances!
Why ?
The only solution I managed to do is to gather counters without the Totals:
$counterLIst=((get-counter -listset Processor).PathsWithInstances | Where-Object {$_ -like "*Processor*" -and $_ -notlike "*Total*" -and $_ -notlike "*Network*" -and $_ -notlike "*Thread*" -and ( $_ -like "* Processor Time*" -or $_ -like "*Interrupts/sec*" )})
In that case it is working, but I will not have Totals in the graph.
Please advise…
Thanks.