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 from the pipeline and their attributes.
The pipeline offers a wide variety of uses; you can leverage commands such as sort-object
to sort by a specific attribute, format-list
to format the objects into a list, and even the select...