Read Performance Counters With Get-Counter
Sample CPU, disk, memory and custom counters as objects.
Run Get-Counter '\Processor(_Total)\% Processor Time' -SampleInterval 1 -MaxSamples 5.
01Command
Command
$ Get-Counter '\Processor(_Total)\% Processor Time' -SampleInterval 1 -MaxSamples 502What it does
Get-Counter returns counter data as objects that can be filtered, compared or exported to CSV, and it accepts -ComputerName for remote hosts. That makes threshold checks and trend logs scriptable instead of relying on PerfMon graphs by eye.
03Risk
!Warning: Counter names are localized and must be quoted correctly; use -ListSet to discover them on a given system.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Get-CounterEvidence: Reads performance counter samples, including remote computers.
Last verified: 2026-10-13 · Category: System & Settings
06Related solutions
Grep on Windows: Select-String
Search inside text files and logs with regex, returning file, line number and match.
Zip Files with Compress-Archive
Create or update a .zip from any files or folder contents straight from PowerShell.
Test a TCP port connection on Windows with Test-NetConnection
A built-in PowerShell one-liner that answers 'is port 5432/3389/443 actually open through this network?' — no telnet client needed.