Format-ConsoleTable
Formats pipeline objects as a width-aware table and writes it to the host.
Syntax
Format-ConsoleTable [-AsWidget] [-Border <Rounded|Square|Double|Minimal>] [-Caption <Object>] [-CardsBelow <Int32>] [-Culture <CultureInfo>] [-GroupBy <Object>] [-InputObject <PSObject>] [-NoHeaderSeparator] [-PassThru] [[-Property] <Object[]>] [-Title <Object>] [-Top <Int32>] [-Total] [-Width <Int32>] [<CommonParameters>]#All Parameter SetsDescription
Formats pipeline objects as a width-aware table and writes it to the host.
Columns come from -Property (like Format-Table: names, wildcards and calculated properties @{ Name; Expression }), from the type's DefaultDisplayPropertySet, or from the objects' properties. Column options go in the same hashtables: Overflow (Wrap, Truncate, TruncateMiddle, Never), MaxLines, Priority, Key, MinWidth, MaxWidth, Width, Alignment, Presenter (Text, Status, Number, Bytes, Duration, Date, DateRelative, DateBoth, Boolean, Bar, Sparkline, Progress, Link), Unit, Aggregate, Header and tone rules (FailAbove, WarnAbove, FailBelow, WarnBelow, PassAbove, PassBelow, Tone). When the table is too wide, low-priority columns hide with a footer that names them; below -CardsBelow cells the rows become record cards; a single object becomes a record view. Redirected output is plain text without escape codes.
Examples
EXAMPLE 1
Format-ConsoleTable -AsWidgetParameters
- -AsWidget SwitchParameter
- Writes the table widget to the pipeline instead of drawing it (for Export-ConsoleFrame, New-ConsolePanel or a dashboard).
- -Border TableBorder
- Border style: Rounded, Square, Double, Minimal or None.
- Possible values:
Rounded,Square,Double,Minimal - -Caption Object
- A caption below the table (markup, muted).
- -CardsBelow Int32
- Below this width (in cells) rows become record cards when the grid cannot fit; 0 disables cards. Default 60.
- -Culture CultureInfo
- The culture for numbers and dates, for example en-US or pl-PL (labels stay English). Defaults to CONSOLEMONSTER_CULTURE, then the current culture, as PowerShell's own formatting does.
- -GroupBy Object
- Groups rows under headings by a property name or a scriptblock; with -Total each group gets a subtotal.
- -InputObject PSObject
- The objects to show (pipeline input).
- -NoHeaderSeparator SwitchParameter
- Underlines the header instead of drawing a separator row.
- -PassThru SwitchParameter
- Also writes the input objects to the pipeline.
- -Property Object[]
- Properties (names, wildcards, calculated properties and column option hashtables).
- -Title Object
- A title above the table (markup).
- -Top Int32
- Shows only the first N rows followed by "Showing N of M" (totals still cover every row).
- -Total SwitchParameter
- Adds a totals row; numeric columns without an Aggregate option are summed.
- -Width Int32
- Lays the table out for this width instead of the terminal's (for files, logs and previews).
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.