• PS 2.0 vs. PS 4.0 Format-Table?

    From Tom@21:1/5 to All on Fri Feb 23 09:27:35 2018
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tom@21:1/5 to Tom on Fri Feb 23 10:24:56 2018
    On Friday, February 23, 2018 at 12:27:38 PM UTC-5, Tom wrote:
    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

    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)