PowerShell Genie

Explain pipeline members

Script 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Get-Process emits its objects and Get-Member consumes them, reporting the type name once and then every property, method, and property set that type exposes.

The script

1PS> Get-Process | Get-Member

Script reader

Inspect before you run

Inspection only

Inspect the script below. It does not run in this browser.

Inspection only — no command has run.

    Show reference output
    1 TypeName: System.Diagnostics.Process
    2
    3 Name MemberType Definition
    4 ---- ---------- ----------
    5 Equals Method bool Equals(System.Object obj)
    6 ToString Method string ToString()
    7 Name Property string Name {get;}
    8 Status Property object Status {get;}
    See the objects move

    Inspect this authored example with fictional data in the bounded browser model. The numbered stages show how its objects change.

    Get-Process | Get-Member
    1. Stage 1Get-ProcessPositional values or no named parameters
    2. Stage 2Get-MemberPositional values or no named parameters

      How it works

      Get-Process emits its objects and Get-Member consumes them, reporting the type name once and then every property, method, and property set that type exposes. The output describes the shape of the object rather than the values in it.

      Adapting it

      Add -MemberType Property to strip the methods out when you are hunting for something to select on, and -Name with a wildcard to find a property whose name you only half remember.

      If the result is unexpected

      Get-Member shows a different type than the one expected downstream.

      Formatting, property expansion or array enumeration can change what reaches the pipeline.

      1. Inspect the object immediately before the failing stage and compare type and property names.

      Validate the result

      The downstream command receives the expected object type and required properties.

      Keep the check reliable

      Keep inspection near pipeline boundaries and format only for final display.

      Primary documentation

      Get-Member reference · Get-Process reference

      Continue
      Genie guideExplain pipeline members

      Get-Process emits its objects and Get-Member consumes them, reporting the type name once and then every property, method, and property set that type exposes.