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

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Windows/...', 1759612698, '216.73.216.149', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Windows/PowerShell/pipeline/formatting/index(73): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78