Using the pipeline
In PowerShell, you can use the output of one command as input for another command by using the vertical bar (|
) character. This is called using the pipeline. The vertical bar character, in PowerShell, is called the pipe character. In PowerShell, complete objects pass through the pipeline. This is different from cmd.exe
or a Linux shell where only strings pass through the pipeline. The advantage of passing complete objects through the pipeline is that you don't have to perform string manipulations to retrieve property values.
Using the ByValue parameter binding
You have already seen some examples of using the pipeline in preceding sections of this book. For example:
PowerCLI C:\> Get-VM | Get-Member
In this example, the output ...
Get Learning PowerCLI - Second Edition 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.