title: Adding objects to array to create multiple columns
body: <p>I'm trying to get the DisplayName of all Software listed in AddRemovePrograms for each computer, add it to an array under the name of the computer, then export. Here's what I have:</p>
  
  <pre><code>$Computers = gc "C:\Get Software.txt"
  $CSV = "C:\Get Software.csv"
  $Results = @()
  
  If (Test-Path $CSV) {
      Remove-Item $CSV
      }
  
  Foreach($Computer in $Computers){
  
      #Get DisplayName of Software Installed on Asset
      $Software = Get-WmiObject Win32Reg_AddRemovePrograms -ComputerName $Computer | Select-Object -ExpandProperty DisplayName
      $counter = 0
  
      While ($counter -lt $Software.count){
  
      #Create a PSObject. Loops through all software and adds to $Results.
      $Obj = New-Object PSOBJECT
      Add-member –inputobject $Obj –membertype Noteproperty  -Name $Computer -Value $Software[$counter]
      $counter++
      $Results+=$Obj
      }
  
  
  
  
  }
  
  
  $Results | Export-Csv $CSV -NoTypeInformation
  </code></pre>
  
  <p>Unfortunately, the output only lists the first Computer in the CSV. I've tried stepping through this to understand it, I just don't understand why I can't add the $Obj variable to $Results with a different Name Property (In this case I'm looping and making a new name based on the computer name in my .txt file). It seems to only take the first input and won't put a new column header then spit out the software. Below is an example of what I'm getting and what I'd like to get instead.</p>
  
  <p>OUTPUT</p>
  
  <pre><code>A01234
  Program1
  Program2
  Program3
  </code></pre>
  
  <p>EXPECTED OUTPUT</p>
  
  <pre><code>A01234     B05678      C09123
  Program1   Program97   Program30
  Program2   Program98   Program31
  Program3   Program99   Program32
  </code></pre>
  
  <p>Hopefully this makes some sense. Any assistance would be appreciated, I'm clearly doing something wrong with the objects and I'm not seeing it. Thanks!</p>