Chapter 9. Formatting
This chapter covers
- PowerShell’s formatting system
- PowerShell’s Format cmdlets
- Creating custom formats
- Formatting tips
PowerShell, as you’ve learned in the preceding chapters, works primarily with objects. Objects are just an in-memory data structure. But the time comes when PowerShell needs to share information from those objects with us humans. PowerShell has to take those in-memory data structures and convert them into something a person can view. PowerShell’s formatting system is designed to accomplish that task.
Whenever you construct a command line, those commands all run in a pipeline. What you don’t see is an invisible cmdlet hanging out at the end of every pipeline: Out-Default. It’s hardcoded into the shell, and you can’t get rid of it. You also never have to explicitly call it. Its sole purpose is to kick off the formatting process, using whatever objects happen to be in the pipeline at that point.