Reputation: 2726
The `Get-Counter '\Process(*)[process counter set]' cmdlet is slow.
Get-Counter
cmdlet and would that be faster? Get-Counter
cmdlet be run in a way that the output refreshes as fast as the same information gets refreshed in the Performance Monitor or Task Manager?Examples:
Get-Counter '\Process(*)\ID Process' -EA SilentlyContinue |
Select -Expand CounterSamples | Select InstanceName, CookedValue
Get-Counter '\Process(*)\% Processor Time' -EA SilentlyContinue |
Select -Expand CounterSamples | Select CookedValue
Get-Counter '\Process(*)\Working Set - Private' -EA SilentlyContinue |
Select -Expand CounterSamples | Select CookedValue
Upvotes: 1
Views: 870
Reputation: 579
The Get-Counter default "-SampleInterval" is already set to the minimum value of 1 second (https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.diagnostics/get-counter?view=powershell-5.1).
So in answer to your first question, yes you can capture the output of each Get-Counter call to a log file with the Out-File command and then you can tail that log file. You will still be limited by the 1 second sample interval though.
Your second question is also limited by the 1 second sample interval, so no.
Upvotes: 2