I have a little problem while trying to add a row to a table. I stored the original values in a variable and used a custom object to transfer them into a table format.
$table = @( @{ColumnA="Able";    ColumnB=1; ColumnC=4},
            @{ColumnA="Baker";   ColumnB=2; ColumnC=3},
            @{ColumnA="Charlie"; ColumnB=3; ColumnC=5} )
$t2 = $table | ForEach {[PSCustomObject]$_} | Format-Table -AutoSize
After that I stored a new object in a variable and appent it to the table var.
$newRow = New-Object PsObject -Property @{ ColumnA = "James" ; ColumnB = 4 ; ColumnC = 12 }
$t2 += $newRow
$t2
My expectation was to get the following result:
ColumnC ColumnB ColumnA
------- ------- -------
      4       1 Able   
      3       2 Baker  
      5       3 Charlie
      12      4 James
But what I receive is this:
ColumnC ColumnB ColumnA
------- ------- -------
      4       1 Able   
      3       2 Baker  
      5       3 Charlie
ColumnC ColumnB ColumnA
------- ------- -------
     12       4 James  
How can I integrate all rows in ONE table?
thanks, Daniel