PS 2.0 vs. PS 4.0 Format-Table?

20 views
Skip to first unread message

Tom

unread,
Feb 23, 2018, 12:27:38 PM2/23/18
to
Greetings,


I have the following code:

$col=@(
[PSCustomObject]@{"partno"="12345"},
[PSCustomObject]@{"support_file"="part.txt"},
[PSCustomObject]@{"readme"="none"},
[PSCustomObject]@{"version"="4.0"})
#
$col | Format-Table

On Windows 7, PS version 2.0:


Name Value
---- -----
partno 12345
support_file part.txt
readme none
version 4.0

Looks good, nice table format...


On Windows 7, PS version 4.0:

partno
------
12345

Same code, different results? What can I do to get the 2.0 table version to
work on the PS 4.0 version? It would be helpful if whatever was done for 4.0 to be backwards compatible, but if I can just get the table format to work like it did on 2.0 I'll be happy. Any ideas?

Thanks
Tom

Tom

unread,
Feb 23, 2018, 1:24:59 PM2/23/18
to
Got it. It's the Object that I created. Changed "PSCustomObject" to "PSObject" and all is well. Works on 2.0 as well. Sorry for the noise...

Tom

Reply all
Reply to author
Forward
0 new messages