I'm trying to get some information with the Get-Counter
method in PowerShell.
When I tried to get the actual processor frequency, I noticed that I get multiple values because there are multiple instances.
_total
the overall frequency (will ever be 0),
0,_total
the overall frequency of the first processor (also ever 0)
and 0,0
up to 0,3
for each core.
To get the information I use:
(Get-Counter "\Prozessorinformationen(*)\Prozessorfrequenz").countersamples
The wildcard specifies for which instance/-s the information is fetched (in this case all)
Path InstanceName CookedValue
---- ------------ -----------
\\mypc\prozessorinformationen(_total)\prozessorfrequenz _total 0
\\mypc\prozessorinformationen(0,_total)\prozessorfrequenz 0,_total 0
\\mypc\prozessorinformationen(0,3)\prozessorfrequenz 0,3 2601
\\mypc\prozessorinformationen(0,2)\prozessorfrequenz 0,2 2601
\\mypc\prozessorinformationen(0,1)\prozessorfrequenz 0,1 2601
\\mypc\prozessorinformationen(0,0)\prozessorfrequenz 0,0 2601
Now I wanted only the results for the single cores. In this special case I could use 0,?
to get the expected result, but if I've (just theoretically) 100000 cores, the number of cores has as much characters as '_total'.
Finally, what i want to know, is it possible to specify a wildcard in a string to accept only values of a specified type (like in this case 'digit'), or do i have to pipe and filter the result?
I tried to use [0-9]
but this didn't work