Behind the PowerShell Pipeline logo

Behind the PowerShell Pipeline

Subscribe
Archives
April 18, 2024

Going Out with a Bang!

I'm sure you'll agree that PowerShell is a terrific management and automation tool. The concept of passing objects through the pipeline is a powerful feature that makes it easy to work with almost anything in PowerShell. And, you don't need to be a developer. PowerShell handles everything for you, including how to present output. PowerShell uses two special cmdlets to manage the pipeline: `Out-Default` and `Out-Host`. These cmdlets are responsible for formatting and displaying the output of a command. They are added automatically to every PowerShell expression. You do not need to specify them. `Out-Default` is responsible for figuring out what type of output is being sent to the pipeline and then sending it to the appropriate formatting cmdlet using `Out-Host`. You can read a description of this process from Jeffrey Snover himself at [https://devblogs.microsoft.com/powershell/how-powershell-formatting-and-outputting-really-works/](https://devblogs.microsoft.com/powershell/how-powershell-formatting-and-outputting-really-works/). The problem that introduces the article has long been fixed. Normally, you can ignore these cmdlets. However, there is an intriguing opportunity with `Out-Default`. If I remember correctly, Lee Holmes (one of the original PowerShell team members) told me that the `Out-Default` command is a placeholder that allows users to customize the output experience. I thought we'd have a little fun with that idea.

Get a premium subscription for full article and archive access

I'm sure you'll agree that PowerShell is a terrific management and automation tool. The concept of passing objects through the pipeline is a powerful feature that makes it easy to work with almost anything in PowerShell. And, you don't need to be a developer. PowerShell handles everything for you, including how to present output.

PowerShell uses two special cmdlets to manage the pipeline: Out-Default and Out-Host. These cmdlets are responsible for formatting and displaying the output of a command. They are added automatically to every PowerShell expression. You do not need to specify them. Out-Default is responsible for figuring out what type of output is being sent to the pipeline and then sending it to the appropriate formatting cmdlet using Out-Host. You can read a description of this process from Jeffrey Snover himself at https://devblogs.microsoft.com/powershell/how-powershell-formatting-and-outputting-really-works/. The problem that introduces the article has long been fixed.

Normally, you can ignore these cmdlets. However, there is an intriguing opportunity with Out-Default. If I remember correctly, Lee Holmes (one of the original PowerShell team members) told me that the Out-Default command is a placeholder that allows users to customize the output experience. I thought we'd have a little fun with that idea.

Want to read the full issue?
GitHub Bluesky LinkedIn About Jeff
Powered by Buttondown, the easiest way to start and grow your newsletter.