Cyber Intelligence
PowerShell Foundations · Foundation

L2. The Pipeline: Objects, Properties, and Methods

Learn how PowerShell passes objects through the pipeline and how to inspect, select, sort, and format those objects without brittle text parsing.

The Mental Model

The pipeline is the center of PowerShell. A command writes objects. The next command receives those objects. You can inspect the object shape, select the properties you need, and pass the result onward.

Get-Process | Get-Member
Get-Process | Select-Object -First 5 Name, Id, CPU
Get-Process | Sort-Object CPU -Descending | Select-Object -First 10
Get-Member is your microscope. If you do not know what a command returns, pipe it to Get-Member before guessing property names.

Select vs Format

Select-Object changes the objects in the pipeline. Format-Table and Format-List change how output looks on screen. For scripts, export, or downstream processing, select data first and format only at the end.
GoalCommand
Keep specific propertiesSelect-Object Name, Status
Sort by a propertySort-Object StartTime
Group by a propertyGroup-Object Status
Display in columnsFormat-Table
Display all properties verticallyFormat-List *

Practical Example

Get-Service |
  Where-Object Status -eq 'Running' |
  Sort-Object DisplayName |
  Select-Object Name, DisplayName, Status

This reads like a sentence: get services, keep running ones, sort by display name, and return only the fields we care about.

Lab

  1. Use Get-Process | Get-Member to find the process object type.
  2. List the 10 processes using the most CPU.
  3. List stopped services with only Name, DisplayName, and Status.
  4. Explain why Format-Table should usually be the last command in a pipeline.

Sources

Exam Focus Points
  • Use Get-Member to inspect the type, properties, and methods returned by a command
  • Select-Object shapes pipeline data; Format-* commands are for final display
  • Where-Object filters objects by property values
  • Sort-Object orders objects without converting them to text
  • Object pipelines are less fragile than parsing column-aligned command output
Knowledge Check

1. Which command should you use to discover the properties available on pipeline objects?

2. Why should Format-Table usually appear at the end of a pipeline?

Recommended: Pluralsight

This free course covers the theory. Pluralsight adds structured video courses, hands-on Azure labs, and timed practice exams to make it stick before exam day.

Start AZ-500 prep free10-day free trial available