Search notes:

PowerShell: Formatting the output of a pipeline

Default last cmdlet

PowerShell automatically places the out-default cmdlet the end of every pipeline.
By default, out-default invokes out-host.

Checking for predefined view

Are there any predefined views that contains the instructions on how format the objects (for example kind of layout such as table or list).
These have a format.ps1xml suffix and are installed under the location that the automatic variable $psHome points at:
PS c:\> get-childItem $psHome -filter *.format.ps1xml

DefaultPropertySet

If there is no predefined view, PowerShell checks for an object with the special DefaultPropertySet property.

Table or list layout

Without predefined view or a DefaultPropertySet, the data is formated in a table if there are 4 or fewer properties and in a list otherwise.

Formatting cmdlets

PowerShell provides a few cmdlets that allow to override the default formatting:
These format-* cmdlets should be the last cmdlets in a pipeline except if followed by out-file, out-printer or out-host (the last of which is the last cmdlet by default anyway).

See also

Displaying objects in the console

Index