Skip to content
ConsoleMonster

Coming from Format-Table

Format-ConsoleTable, Format-ConsoleList and Format-ConsoleTree beside the built-in Format cmdlets: pipeline input, -Property and their column options.

The three Format cmdlets take pipeline input like the built-in Format-Table, Format-List and Format-Custom, which remain the right choice when output should go through PowerShell's formatting system. They write to the console like Write-Host, so $x = ... | Format-ConsoleTable captures nothing; -PassThru also writes the input objects to the pipeline, and -AsWidget returns the widget for Write-ConsoleWidget or Export-ConsoleFrame.

format-table.ps1 PowerShell 7.6
Name                        Kind    Length Time             Signed Path
----                        ----    ------ ----             ------ ----
ConsoleMonster.2.0.0.nupkg  NuGet  1482113 00:00:48.2000000   True C:\Support\GitHub\ConsoleMonste…
ConsoleMonster.2.0.0.snupkg NuGet   402331 00:00:03.1000000   True C:\Support\GitHub\ConsoleMonste…
ConsoleMonster-2.0.0.zip    Module 2904576 00:00:11.7000000   True C:\Support\GitHub\ConsoleMonste…
Docs.zip                    Module   51302 00:00:01.2000000  False C:\Support\GitHub\ConsoleMonste…
format-consoletable.ps1 PowerShell 7.6
 PSPublishModule artifacts
╭─────────────────────────────┬─────────┬──────────┬────────┬──────────────────────────────────────╮
│ Name                        │    Size │ Built in │ Signed │ Path                                 │
├─────────────────────────────┼─────────┼──────────┼────────┼──────────────────────────────────────┤
│ NuGet  2                                                                                         │
│ ConsoleMonster.2.0.0.nupkg  │ 1.41 MB │     48 s │ ✓ yes  │ C:\Support\GitHub\…nster.2.0.0.nupkg │
│ ConsoleMonster.2.0.0.snupkg │  393 KB │    3.1 s │ ✓ yes  │ C:\Support\GitHub\…ster.2.0.0.snupkg │
│ Subtotal                    │  1.8 MB │     51 s │        │                                      │
│ Module  2                                                                                        │
│ ConsoleMonster-2.0.0.zip    │ 2.77 MB │     12 s │ ✓ yes  │ C:\Support\GitHub\…Monster-2.0.0.zip │
│ Docs.zip                    │ 50.1 KB │    1.2 s │ – no   │ C:\Support\GitHub\…s\Packed\Docs.zip │
│ Subtotal                    │ 2.82 MB │     13 s │        │                                      │
├─────────────────────────────┼─────────┼──────────┼────────┼──────────────────────────────────────┤
│ Total                       │ 4.62 MB │ 1 m 04 s │        │                                      │
╰─────────────────────────────┴─────────┴──────────┴────────┴──────────────────────────────────────╯
The same four objects in PowerShell 7, 100 columns wide: Format-Table -AutoSize, then Format-ConsoleTable with -GroupBy, -Total and column options.

-Property

  • Names, wildcards and calculated properties work as in Format-Table.
  • A hashtable with column options configures that column: Name (or Expression), Header, Key, Priority, MinWidth, MaxWidth, Width, Overflow (Wrap, Truncate, TruncateMiddle, Never), MaxLines, Alignment, Presenter, Unit, Aggregate, Highlight, Markup and thresholds such as WarnAbove and FailBelow.
  • Without -Property, an object's DefaultDisplayPropertySet is used.
Get-ChildItem C:\Windows\Logs -Recurse -File | Format-ConsoleTable -GroupBy Extension -Total -Top 20 -Property @(
    @{ Name = 'Name'; Key = $true }
    @{ Name = 'Length'; Header = 'Size'; Presenter = 'Bytes'; Priority = 9 }
    @{ Name = 'LastWriteTime'; Header = 'Changed'; Presenter = 'DateRelative'; Priority = 5 }
    @{ Name = 'FullName'; Header = 'Path'; Overflow = 'TruncateMiddle'; Priority = 1 }
)

Other parameters

ParameterWhat it does
-GroupByGroups rows, with subtotals when -Total is set.
-TotalA totals row (sum, count, average, minimum or maximum per column).
-Top NOnly the first N rows.
-WidthLays the table out for a given width instead of the console's.
-CultureNumbers and dates in a given culture; by default the current culture, as Format-Table does.
-Title, -Caption, -BorderThe table's frame.

When the console is narrow

Columns hide by priority and a footer names them; below 60 cells, when the minimum widths still do not fit, rows turn into cards titled with the key value. A single object renders as a record view.

format-consoletable.ps1 PowerShell 7.6
PSPublishModule artifacts  ·  4 records

NuGet ConsoleMonster.2.0.0.nupkg Size 1.41 MB Built in 48 s Signed ✓ yes Path C:\Support\GitHub\ConsoleMonster
Artefacts\Packed
ConsoleMonster.2.0.0.nupkg ConsoleMonster.2.0.0.snupkg Size 393 KB Built in 3.1 s Signed ✓ yes Path C:\Support\GitHub\ConsoleMonster
Artefacts\Packed
ConsoleMonster.2.0.0.snupkg

Module ConsoleMonster-2.0.0.zip Size 2.77 MB Built in 12 s Signed ✓ yes Path C:\Support\GitHub\ConsoleMonster
Artefacts\Packed\ConsoleMonster-2.0.0.zip Docs.zip Size 50.1 KB Built in 1.2 s Signed – no Path C:\Support\GitHub\ConsoleMonster
Artefacts\Packed\Docs.zip

Total Size 4.62 MB Built in 1 m 04 s

Format-ConsoleTable from above in a 56-column console.

The tables page shows each behaviour at six widths, and the PowerShell page compares Format-List with Format-ConsoleList.

Edit this page on GitHub