What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

PowerShell pipelines pass objects from command to command; the text you see in the console is usually a formatted view of those objects. If a pipeline loses fields or stops accepting input after a formatting command, keep filtering and transforming the objects first, and format only when you are ready to present the result.

What actually travels through a PowerShell pipeline?

Microsoft Learn describes it this way: “When commands are combined in a pipeline, they pass information to each other as objects.” An object represents a particular kind of thing. Its type identifies that kind, its properties hold data, and its methods expose actions. For example, a file object can have a LastWriteTime property.

The console’s table or list is not necessarily the object itself. It is a presentation of selected information. To inspect the actual output and its members, pipe a command to Get-Member:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Get-ChildItem -Path *.txt | Get-Member

Look at the reported type and properties to learn what the next command can work with. Microsoft’s about_Objects documentation explains PowerShell object types and members.

#1 Best Overall
Sale
PowerShell for Sysadmins: Workflow Automation Made Easy
  • Book - powershell for sysadmins: workflow automation made easy
  • Language: english
  • Binding: paperback

Why might the next command not accept the objects?

The pipeline operator passes output to the next command, but that command must declare a parameter that accepts pipeline input. PowerShell can bind an incoming object by value, when its type matches a parameter or can be converted to the required type, or by property name, when an input property matches a parameter name.

Check the receiving command’s help rather than assuming that a parameter accepts pipeline input:

Get-Help <Command> -Full
Get-Help <Command> -Parameter *

In the help, inspect the relevant parameter’s pipeline-input support and whether binding is by value or by property name. If the parameter does not accept pipeline input, pass the value as an explicit argument or use a command that supports the intended binding. Microsoft’s about_Pipelines documentation describes pipeline parameter binding.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Filter and sort objects before formatting them

This example keeps file data structured while it selects and orders results, then formats the final output for a person:

Get-ChildItem -Path *.txt |
  Where-Object { $_.Length -gt 10000 } |
  Sort-Object -Property Length |
  Format-Table -Property Name, Length
  1. Get-ChildItem emits file objects.
  2. Where-Object keeps objects whose Length property is greater than 10,000.
  3. Sort-Object orders the remaining objects by Length.
  4. Format-Table presents their Name and Length values as a table.

The visible table is the formatted display, not the original file-object stream. Keep operations such as filtering, sorting, selecting, calculating, and exporting on useful object data before using Format-Table or Format-List for human-readable output. Microsoft’s formatting overview distinguishes formatting definitions from the elements an object returns to the pipeline.

Why does a collection behave differently when piped?

PowerShell normally enumerates many collection types when sending their contents through a pipeline, delivering items one at a time. That is not the same as passing a collection itself to a parameter. For example, piping process results sends individual process objects; using Get-Member -InputObject (Get-Process) inspects the array as an input object instead.

Get-Process | Get-Member
Get-Member -InputObject (Get-Process)

Those commands can report different shapes because the first sends pipeline items individually, while the second supplies the collection as the -InputObject argument. If counts or members look unexpected, compare the pipeline form with an explicit collection argument.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Enumeration also has exceptions. Strings are not enumerated character by character, and hash tables, dictionaries, and XML nodes need their enumerator for item-by-item pipeline behavior. DataTable values have documented row-enumeration behavior. Consult the collection details in Microsoft’s pipeline guide when a particular type behaves unexpectedly.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What changes when a native executable is in the pipeline?

Do not assume a native executable behaves like an ordinary PowerShell cmdlet. Native programs use standard input and produce text or, in some scenarios, byte streams; Microsoft documents differences in how native standard input connects to PowerShell pipelines. The exact behavior depends on the PowerShell version and the command scenario.

When a native program is involved, identify whether the issue concerns input, text output, or bytes, and check the documentation for the PowerShell version in use. The native-command sections of Microsoft’s about_Pipelines guide cover these interoperability details.

A quick troubleshooting sequence

  1. Inspect the output type and members. Run the producing command into Get-Member before concluding that it emitted display text.
  2. Check the receiving parameter. Use Get-Help <Command> -Full or Get-Help <Command> -Parameter * to confirm whether it accepts pipeline input and how binding works.
  3. Compare collection forms. If item counts or members differ, test both piped input and an explicit -InputObject or other collection parameter.
  4. Move formatting to the end. Perform object-aware selection, filtering, sorting, and calculations before formatting for display.
  5. Separate native-command behavior. For an executable, investigate text or byte-stream interoperability instead of applying cmdlet assumptions.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.