Use this when passing objects between PowerShell commands.
Pipeline · PowerShell Automation
The PowerShell pipeline passes objects from one command to the next, binding them to parameters by value or property name, such as Get-ADUser -Filter * | Set-ADUser -Department IT.
1. The pipeline streams objects between cmdlets.
2. Filter left (use -Filter on source when possible).
3. ForEach-Object for per-item work.
4. Functions with process {} blocks.
5. Avoid collecting huge arrays unnecessarily.
source → filter → transform → output
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
Use Get-Help to inspect pipeline-input metadata for downstream parameters, then test representative objects with Get-Member. Count and sample objects before and after a transformation, and capture $LASTEXITCODE immediately after native commands. For mutating pipelines, verify the target state separately after the pipeline completes.
Step 2 Common mistakes Narrow the fault
- Formatting (
Format-Table) in the middle of a pipeline.
Step 3 Where it fails Narrow the fault
A pipeline can be syntactically valid but bind the wrong property, silently convert types, enumerate collections unexpectedly or continue after non-terminating errors. Separate upstream object shape, parameter binding, stream behavior, native-process boundaries and final target state. Do not use a pretty table as verification of the pipeline's data contract.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- The pipeline binds objects by value or property name.
- Filter as early as possible.
- Objects stream through the pipeline.
Get-Service | Where-Object Status -eq Running | Sort-Object Name— pipelineMeasure-Command { <pipeline> }— performance- Pipeline-aware functions (ValueFromPipeline) — design
ReferenceWhy it matters1 section · depth on demand
Worked example
The PowerShell pipeline passes objects — not text — from one command to the next. Each object keeps its properties and methods, so later commands can filter, sort and select by property name without parsing output. This is the main difference from Unix shells and the reason PowerShell one-liners stay readable.
Worked example: find stopped services that should start automatically, on several servers, and export a report.
Get-CimInstance Win32_Service -ComputerName srv01, srv02 -Filter "StartMode='Auto' AND State<>'Running'" |
Select-Object PSComputerName, Name, DisplayName, State |
Sort-Object PSComputerName, Name |
Export-Csv stopped-auto-services.csv -NoTypeInformation
Filter as early as possible (-Filter on the source command is evaluated remotely and is far faster than Where-Object afterwards), and use Select-Object near the end to shape the output.
ReferenceImportant terms & boundaries1 section · depth on demand
PowerShell mechanics
The PowerShell pipeline passes objects through the success stream and binds them to downstream parameters. Binding can occur by value or by property name, with type conversion and parameter-set selection influencing the result. Native commands are a separate text/process boundary, and some commands buffer input while others stream item-by-item, which changes memory, ordering and latency behavior.
ReferenceConfiguration & state1 section · depth on demand
Authoring and lifecycle
Build pipelines so each stage has a clear input/output contract. Filter and project objects before expensive remote or serialization boundaries, delay formatting until the final human-facing step, and avoid relying on implicit property-name binding when a schema can vary. When mixing native tools with PowerShell, quote arguments deliberately and handle encoding plus exit codes explicitly.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Configuration & expected output
Concrete examples are shown only when the stored reference contains an actual configuration or output shape for this Topic.
Configuration example
Assumptions: Review target identity, permissions and environment before mutation.
Get-Process | Where-Object CPU -gt 0 | Select-Object Id,ProcessName,CPUVerification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Microsoft Learn documentation reviewed for bounded PowerShell reference claims. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_pipelines?view=powershell-7.5 · confidence 94%Quick lookup tables
Pipeline · PowerShell operational reference
Topic-specific PowerShell runtime identity, persistence, verification, output and failure-boundary lookup.
| Boundary | Pipeline reference |
|---|---|
| Runtime identity | PowerShell edition/version + command/module source |
| Persistent intent | Script/module/config prerequisites under source control |
| Verification | Read-only discovery → execution evidence → independent target read-back |
| Output contract | Structured objects/streams before formatting |
| Failure boundary | Separate engine/binding from transport/API/native and target-state failures |
Deep reference
Healthy vs suspicious evidence
Output interpretation
Pipeline display order does not necessarily show execution order when concurrency or remote operations are involved. Formatting cmdlets terminate the useful object-data contract for further machine processing. Non-terminating errors can interleave with success output, and native stderr/stdout/exit-code behavior does not map one-to-one to PowerShell ErrorRecords.