Powershell Get a specific process counter with id process
counter, powershell, process
Solution
You can get counters for a process name so first get the process name by using its Id and then embed the process name in the counter. For example:
$id = # your process id
$proc = (Get-Process -Id $id).Name
Get-Counter -Counter "\Process($proc)\% Processor Time"
Problem
I want to get specific counters for processes that I have process id's for. However I can't think of a way to use where-object to match the process for the counter. Like ``` Where Gc '\process(*)\id process -eq 456 gc '\process($name)\working set' ``` So use the process id to retrieve the name and get the working set (or something to that effect).