Chapter 12. Creating custom format views

We’re getting back to the script that we left off with in chapter 10, before our short diversion into the world of debugging. One thing we didn’t like about that script was its output. Some folks would be tempted to put commands right into the script to fix that, but we know better. Remember: A tool should either create input for another tool, do something, or format output from another tool. Our tool is already doing something, so we can’t have it start messing around with formatting the output as well. Instead, we’ll get PowerShell to do that for us by creating a custom view.

12.1. The anatomy of a view

PowerShell ships with a number of views, all of which are contained in .format.ps1xml files that ...

Get Learn PowerShell Toolmaking in a Month of Lunches 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.