Powershell : Pipelines Explained, Part -1

A pipeline is a series of commands connected by pipeline operators| ‘.
Each pipeline operator sends the results of the preceding command to the next command.

That means output by one command can be used as input to another command for processing using pipelines. And you can send the output of that command to yet another command and the resultant is a very powerful command chain or “pipeline” that is comprised of a series of simple commands.

For example,

Command-1 | Command-2 | Command-3

In a pipeline, the commands are processed from left to right in the order that they appear. The processing is handled as a single operation and output is displayed as it is generated.

Here is a simple example. The following command gets the Bits service and then stops it.

Get-Service BITS | Stop-Service

The first command uses the Get-Service cmdlet to get an object representing the Bits service. It uses a pipeline operator (|) to send the service object to the Stop-Service cmdlet, which stops the Bits service.


This command pipeline gets the Process objects starting with Alphabet ‘a’ , selects only the processes that have Handles more than 150 and sorts them by CPU, and displays the output in a table format.

Get-Process a* | ?{$_.Handles -gt 150} | Sort-Object -Property CPU

This pipeline is comprised of Three commands in the specified order. The command above is written horizontally, but we will show the process vertically in the following graphical representation.


Happy Learning ! 🙂


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s