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 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 manipulation to retrieve property values.
Using the ByValue parameter binding
You have already seen some examples of using the pipeline in previous sections of this book, for example:
PowerCLI C:\> Get-VM | Get-Member
In this example, the output of the
Get-VM
cmdlet ...
Get Learning PowerCLI 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.