Explore performance counters with Get-Counter
Get-Counter is the cmdlet you use both to discover the counter sets available on a machine, and to obtain performance samples from a local or remote server. In this recipe, you use a Windows Server 2016 server, SRV1, to examine performance counter sets and counters on local and remote computers.
Getting ready
This recipe uses several remote machines: DC1, CA, SRV1, FS1, FS2, and PSRV. Adjust the recipe to reflect the computers in your testing or production environment.
This recipe uses several servers to simulate a normal organization. Consider using fewer servers.
How to do it...
- You start by using
Get-Counterto discover performance counter sets on the local machine:
$CounterSets = Get-Counter -ListSet * "There are {0} counter sets on [{1}]" ` -f $CounterSets.count, (hostname)
- Discover performance counter sets on remote systems:
$Machines = 'DC1', 'CAa', 'SRV1', 'FS1', 'FS2', 'PSRV' foreach ($Machine in $Machines...