I have an arraylist of objects, but I want to output them to the console in a tabular format like Get-Process
does for processes.
How can I output a List as a Table?
Format-Table just throws an error
$bulidsList | Format-Table -Auto -InputObject $bulidsList
"The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input"
You mentioned in the question "An arraylist of objects". Here is a simple test to show you how those used with Format-Table:
$a = @()
$a += [pscustomobject]@{a = 1; b = 2}
$a += [pscustomobject]@{a = 3; b = 4}
$a += [pscustomobject]@{a = 5; b = 6}
$a | Format-Table
Here is the output:
a b
- -
1 2
3 4
5 6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With