1

I have 3 objects that I have created. Each only has VM names in them. I am trying to combine the 3 objects into 3 columns. There is nothing to join them on. This is purely for aesthetics.

I have tried Hash Tables, but that just makes a staggered table.

Something similar to this.

| HBR VM     | RPO Violated| RPO Violations |
|:-----------|------------:|:--------------:|
| VM 1       | VM 6        | VM 2
| VM 2       |             | VM 6    
| VM 3       |             |     
| VM 4       |             |     
| VM 5       |             |     
| VM 6       |             | 
Unfundednut
  • 314
  • 1
  • 6
  • 25

1 Answers1

1

This is probably the easiest way: https://gallery.technet.microsoft.com/Combine-Objects-02516b79

$arguments = [Pscustomobject]@()

foreach ( $Property in $Object1.psobject.Properties){
    $arguments += @{$Property.Name = $Property.value}
}

foreach ( $Property in $Object2.psobject.Properties){
    $arguments += @{ $Property.Name= $Property.value} 
}

$Object3 = [Pscustomobject]$arguments
Jacob Colvin
  • 2,625
  • 1
  • 17
  • 36