Piping variables

The concept of piping isn't anything new to the scripting world. Piping, by definition, is directing the output of an object to another object. When you use piping in PowerShell, you are taking the output of one command and sending the data for use with another section of code. The manipulation can be either to a more legible format, or can be by selecting a specific object and digging deeper into those attributes. A pipe is designated by the '|' symbol and is used after you enter a command. The construct of a pipe looks like this: command | ResultManipulation | SortingObjects. If you need to access the individual items in the pipeline, you can leverage the pipeline output $_ command. This tells the pipeline to evaluate the results ...

Get Mastering Windows PowerShell Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.