PowerShell Genie

Get-Counter

Use Get-Counter to read Windows performance counter values, once or as a continuous sample.

Command 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn — get-counter

Syntax

1PS> Get-Counter [-Counter] <String[]> [-SampleInterval <Int32>] [-MaxSamples <Int64>] [<CommonParameters>]
2PS> Get-Counter -ListSet <String[]> [<CommonParameters>]
See the command anatomy

Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

Get-Counter [-Counter] <String[]> [-SampleInterval <Int32>] [-MaxSamples <Int64>] [<CommonParameters>] Get-Counter -ListSet <String[]> [<CommonParameters>]
  1. Stage 1Get-Counter-Counter -SampleInterval -MaxSamples -ListSet

    Try it

    Windows PowerShell

    PowerShell example · browser support is limited.

    Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.

    Interactive simulation · fictional data

    Examples

    Get-Counter -Counter "\Processor(_Total)\% Processor Time"

    1PS> Get-Counter -Counter "\Processor(_Total)\% Processor Time" -MaxSamples 3
    Show reference output

    Illustrative output · values vary by environment

    Timestamp            CounterSamples
    ---------            --------------
    10/01/2026 09:00:00   \processor(_total)\% processor time : 12.48
    10/01/2026 09:00:01   \processor(_total)\% processor time : 18.06
    10/01/2026 09:00:02   \processor(_total)\% processor time : 15.22

    Get-Counter -ListSet Processor

    1PS> Get-Counter -ListSet Processor | Select-Object -ExpandProperty Paths
    Show reference output

    Illustrative output · values vary by environment

    \Processor(*)\% Processor Time
    \Processor(*)\% User Time
    \Processor(*)\% Privileged Time

    Get-Counter -Counter "\Memory\Available MBytes"

    1PS> Get-Counter -Counter "\Memory\Available MBytes" -SampleInterval 2 -MaxSamples 5
    Show reference output

    Illustrative output · values vary by environment

    Timestamp            CounterSamples
    ---------            --------------
    10/01/2026 09:00:00   \memory\available mbytes : 6144
    10/01/2026 09:00:02   \memory\available mbytes : 6128
    10/01/2026 09:00:04   \memory\available mbytes : 6100
    10/01/2026 09:00:06   \memory\available mbytes : 6152
    10/01/2026 09:00:08   \memory\available mbytes : 6160

    Parameters

    Parameter definitions:

    • -Counter
    • -SampleInterval
    • -MaxSamples
    • -Continuous
    • -ComputerName
    • -ListSet

    Microsoft Learn — get-counter

    Read the right counter and sample count

    Get-Counter reads Windows performance counters. Counter-set and counter names can be localized: discover valid paths with -ListSet on the target computer rather than assuming an English path exists everywhere.

    Sampling and output

    -MaxSamples limits the number of samples; -SampleInterval controls the interval in seconds. -Continuous keeps collecting until interrupted. Each measurement contains a timestamp and a CounterSamples collection; inspect its CookedValue for a numerical value.

    Discovery is a different operation

    -ListSet returns counter-set information, not measurements. Expanding its Paths property gives path strings. Some counter sets need elevated access. If a counter is missing, first check its name, target availability and permissions.

    A short sample is a point-in-time observation, not a capacity trend. Choose a meaningful measurement period before drawing conclusions.

    Summarize numeric object properties

    Updated 1 October 2026. Browser outputs are fictional; check the installed module help for your environment.

    Recap

    Get-Counter Use Get-Counter to read Windows performance counter values, once or as a continuous sample.

    Next: Get-AuthenticodeSignature
    Genie guideGet-Counter

    Use Get-Counter to read Windows performance counter values, once or as a continuous sample. The console below is pre-loaded — run it, then change a value and run it again.