maybe you can find help on the scripting guy site :
(Get-Counter -ListSet 'processor information').paths | get-counter
Question
When I try to select a counter of which I know the name and the fact that is exists, like for example Get-Counter -ListSet '\ProcessorPerformance(*)\frequency' | Select-Object -ExpandProperty Counter
, I get the error that:
Get-Counter : Cannot find any performance counter sets on the localhost computer that match the following: \ProcessorPerformance(*)\frequency. At line:1 char:1
How can I get a counter when I know the full name or path?
Solution
maybe you can find help on the scripting guy site :
(Get-Counter -ListSet 'processor information').paths | get-counter
OTHER TIPS
You're mixing sets and counters. The counter 'Processor Frequency'
is contained within the set named 'Processor Information'
. Your example is asking for a set named '\ProcessorPerformance(*)\frequency'
, which does not exist.
A brief example:
# Get the set for Processor Information.
$set = Get-Counter -ListSet 'Processor Information'
# List available counters in set.
$set.Counter
# Alternatively, get just the specific counter.
Get-Counter -Counter '\Processor Information(*)\Processor Frequency'