Jérôme
Jérôme

Reputation: 27027

Format-Table not displaying all properties with PowerShell 5

With PowerShell V4, I could use Format-Table to display several properties using a wildcard, for instance :

PS C:\powershell> gci | Format-Table -Property PS*

PSPath                  PSParentPath           PSChildName            PSDrive                PSProvider                      PSIsContainer
------                  ------------           -----------            -------                ----------                      -------------
Microsoft.PowerShell... Microsoft.PowerShel... test1.txt              C                      Microsoft.PowerShel...                  False
Microsoft.PowerShell... Microsoft.PowerShel... test2.txt              C                      Microsoft.PowerShel...                  False
Microsoft.PowerShell... Microsoft.PowerShel... test3.txt              C                      Microsoft.PowerShel...                  False

Now, with PowerShell V5, I don't get the same result with the same command :

PS C:\powershell> gci | Format-Table -Property PS*

PSPath                                                          PSParentPath                                      
------                                                          ------------                                      
Microsoft.PowerShell.Core\FileSystem::C:\powershell\test1.txt   Microsoft.PowerShell.Co...
Microsoft.PowerShell.Core\FileSystem::C:\powershell\test2.txt   Microsoft.PowerShell.Co...
Microsoft.PowerShell.Core\FileSystem::C:\powershell\test3.txt   Microsoft.PowerShell.Co...

Only two properties are displayed.

Why is the new behavior and is there a way to change it to the one of V4 ?

Upvotes: 4

Views: 10469

Answers (1)

TravisEz13
TravisEz13

Reputation: 2413

PowerShell 5 had a change to how columns are auto-sized by default. It cannot fit the additional columns on the page. Adding -AutoSize will not resolve the issue.

You could increase the side of the window.

Additionally, @PetSerAl's following suggestion will let you specify the width of the columns but you loose auto-sizing.

Get-ChildItem | Format-Table -Property @{expression='ps*'; width=10}

Upvotes: 5

Related Questions