Book Image

Getting Started with Powershell

Book Image

Getting Started with Powershell

Overview of this book

Table of Contents (19 chapters)
Getting Started with PowerShell
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Next Steps
Index

The pipeline as an assembly line


The pipeline in PowerShell is a mechanism to get data from one command to another. Simply put, the data that is output from the first command is treated as input to the next command in the pipeline. The pipeline isn't limited to two commands, though. It can be extended practically as long as you like, although readability would suffer if the line got too long.

Here is a simple pipeline example:

Tip

In this example, I've used some common aliases for cmdlets (where, select) to keep the line from wrapping. I'll try to include aliases when I mention cmdlets, but if you can't figure out what a command is referring to, remember you can always use Get-Command to find out what is going on. For example, Get-Command where tells you Where is an alias for Where-Object. In this case, select is an alias for Select-Object.

The execution of this pipeline can be thought of in the following sequence:

  • Get the list of services

  • Choose the services that have the Running status

  • Select...