Chapter 13. Using all the pipelines
A couple of chapters ago, we pointed out that adding [CmdletBinding()] to a Param() block would enable the output of certain commands for verbose, warning, informational, and other output. Well, it’s time to put that to use and demonstrate why you’d want to use them.
It’s useful to understand that PowerShell has six channels, or pipelines, rather than the one we normally think of. First up is the Success pipeline, which is the one you’re used to thinking of as “the pipeline.” This gets some special treatment from the PowerShell engine. For example, it’s the pipeline used to pass objects from command to command. Additionally, at the end of the pipeline, PowerShell sort of invisibly adds the Out-Default cmdlet, which has the effect of running any objects in the pipeline through PowerShell’s formatting system. Whatever hosting application you’re using—the PowerShell console, ISE, and so on—is responsible for dealing with that output by placing it onto the screen or doing something else with it.
But there are five other pipelines:
- Success, which we discussed
- Error
- Warning
- Verbose
- Debug
- Information