Formatting Cmdlets

Several formatting cmdlets are very useful:

Format-Table (alias ft)—Cmdlet that prints out properties in a table-based format.

Format-List (alias fl)—Cmdlet that prints out properties in a list-style format.

Some simple examples of Format-Table can be easily demonstrated, as you can see here:

image

In this example, you use the Get-Process cmdlet to list the properties of the powershell.exe process. By default, the PowerShell formatting subsystem determines what properties to display. Using Format-Table, you modify the properties displayed. The –autosize parameter is used to shorten and align all the columns neatly.

Note

There ...

Get Microsoft® SQL Server 2008 R2 Unleashed 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.