Format-Table on Array of Hash Tables Format-Table on Array of Hash Tables powershell powershell

Format-Table on Array of Hash Tables


Using Powershell V4:

$table = @( @{ColumnA="Able";    ColumnB=1},            @{ColumnA="Baker";   ColumnB=2},            @{ColumnA="Charlie"; ColumnB=3} )$table | ForEach {[PSCustomObject]$_} | Format-Table -AutoSizeColumnA ColumnB------- -------Able          1Baker         2Charlie       3

V2 solution:

$(foreach ($ht in $table) {new-object PSObject -Property $ht}) | Format-Table -AutoSize