11 Formatting: And why it’s done on the right

 

Let’s quickly review. You know that PowerShell cmdlets produce objects and that those objects often contain more properties than PowerShell shows by default. You know how to use gm to get a list of all of an object’s properties, and you know how to use Select-Object to specify the properties you want to see. Up to this point in the book, you’ve relied on PowerShell’s default configuration and rules to determine how the final output will appear on the screen (or in a file, or in hard-copy form). In this chapter, you’ll learn to override those defaults and create your own formatting for your commands’ output.

11.1 Formatting: Making what you see prettier

We don’t want to give the impression that PowerShell is a full-fledged management-reporting tool, because it isn’t. But PowerShell has good capabilities for collecting information, and, with the right output, you can certainly produce reports using that information. The trick is getting the right output, and that’s what formatting is all about.

11.2 Working with the default formatting

11.3 Formatting tables

11.4 Formatting lists

11.5 Formatting wide lists

11.6 Creating custom columns and list entries

11.7 Going out: To a file or to the host

11.8 Another out: GridViews

11.9 Common points of confusion

11.9.1 Always format right

11.9.2 One type of object at a time, please

11.10 Lab

11.11 Lab answers

11.12 Further exploration