[30]: Get-Process svchost
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
260 13 6088 10408 67 1,87 248 svchost
759 43 12540 15400 112 3,95 684 svchost
708 39 21840 17420 150 9,22 768 svchost
...
94 8 2680 4552 50 0,16 2324 svchost
[31]: Get-Counter -list process -computer c | select -exp
pathswithinstances | ? { $_ -match 'svchost' }
\\c\Process(svchost)\% Processor Time
\\c\Process(svchost)\% Processor Time
....
\\c\Process(svchost)\% Processor Time
\\c\Process(svchost)\% User Time
....
count of % Processor Time is the same as count of svchost processes.
When I want counters related to svchost-s, I get only one sample!
[32]: Get-Counter 'Process(svchost)\% Processor Time' -ComputerName
devol
Timestamp CounterSamples
--------- --------------
19.11.2009 13:48:08 \\c\process(svchost)\% processor time :
0
First question - why I get only one sample for [32] command?
Second - how do I get samples only for svchost with Id 12345? It's
pretty useless when you don't know how to query one particular
process :(
If you check "help get-counter", you can specify these parameters to get
more than one value:
[-MaxSamples <Int64>]
[-SampleInterval <int>]
> Second - how do I get samples only for svchost with Id 12345? It's
> pretty useless when you don't know how to query one particular
> process :(
That's a good question. I don't know if you'll be able to use Get-Counter
if you need a specific ID...
Marco
To the second question - I need to get samples for one particular
svchost, it doesn't matter how the proc is identified. I just see the
process in ProcessExplorer and I need to get its counters in
PowerShell. It seems impossible.
On 19 lis, 18:13, "Marco Shaw [MVP]" <marco.shaw@NO_SPAMgmail.com>
wrote:
I'll the more raw .NET method maybe tomorrow...
Marco