Why does PowerShell cut off column values?

powershell

Solution

`Format-Table -Autosize` is limited to the width of your screen buffer. One option would be to output it to a text file or use `Out-GridView` rather than `Format-Table`

e.g.

Get-SPSite -WebApplication http://contoso.intranet.com -Limit All 
| where {$_.RootWeb.Created -ge $Yesterday -And $_.RootWeb.Created -lt $Tomorrow} 
| ft Url, @{Name='Created';Expression={$_.RootWeb.Created}},@{label="Size in MB";Expression={$_.usage.storage/1MB}} 
| Format-Table -Wrap -AutoSize
| Out-String -Width 4096 `
| Out-File C:\SPSites.txt

or

Get-SPSite -WebApplication http://contoso.intranet.com -Limit All 
| where {$_.RootWeb.Created -ge $Yesterday -And $_.RootWeb.Created -lt $Tomorrow} 
| ft Url, @{Name='Created';Expression={$_.RootWeb.Created}},@{label="Size in MB";Expression={$_.usage.storage/1MB}} 
| Out-GridView  

Problem

When I use autosize it only fixes the last column and then it breaks the first column, meaning all the values shows up for the last with a halfway chopped off value for the first column. Is there a fix for that? ``` Get-SPSite -WebApplication http://contoso.intranet.com -Limit All | where {$_.RootWeb.Created -ge $Yesterday -And $_.RootWeb.Created -lt $Tomorrow} | ft Url, @{Name='Created';Expression={$_.RootWeb.Created}},@{label="Size in MB";Expression={$_.usage.storage/1MB}} | Format-Table -Wrap -AutoSize ```

Original source