Format-Table behavior in PowerShell 5

Welcome Forums General PowerShell Q&A Format-Table behavior in PowerShell 5

This topic contains 1 reply, has 2 voices, and was last updated by

3 years, 3 months ago.

  • Author
  • #38071

    Topics: 9
    Replies: 62
    Points: 6
    Rank: Member

    In PowerShell 4 and below, absent the -Autoformat switch, Format-Table spreads out the columns across the console, with guesses about appropriate column widths based on just the first object in the pipeline.

    In PowerShell 5, Format-Table without the -Autoformat switch uses -Autoformat -like formatting based on however many objects it get from the pipeline in the first 300 milliseconds.

    With the -Autoformat switch, Format-Table waits until it has all of the items from the pipeline before making decisions on column widths.

    Most of the time, the default PowerShell 5 behavior or the -Autoformat behavior works great. But on rare occasions, neither produces readable results, and the default PowerShell 4 behavior would be preferable.

    Is there a way in PowerShell 5 to force Format-Table to behave like it did in PowerShell 4?

  • #38072

    Topics: 13
    Replies: 4872
    Points: 1,843
    Helping HandTeam Member
    Rank: Community Hero

    It's coded into the formatting system. Although you could obviously create custom views for your objects, which would become their default views rather than the generic behavior.

The topic ‘Format-Table behavior in PowerShell 5’ is closed to new replies.