title: powershell invoke-command to variable and write out as a table
body: <p>I have the following code, from what I would like to get the output to </p>
  
  <blockquote>
    <p>$output</p>
  </blockquote>
  
  <p>and write-host at the end:</p>
  
  <pre><code>$outputs = @()
  foreach ($comp in $maschines.name) { 
      $output = New-Object PSObject -Property @{
              invoke-command -computer comp3 -ScriptBlock { get-vm –VMName $using:comp | Select-Object VMId | Get-VHD | ft @{
              label="vm"; expression={$using:comp}}, 
              path,
              VhdType, 
              VhdFormat, 
              @{label="file(gb)"; expression={($_.FileSize / 1GB) -as [int]}}, 
              @{label="size(gb)"; expression={($_.Size / 1GB) -as [int]}} -AutoSize 
          }
      }
      $outputs += $output
  }
  
  $outputs
  </code></pre>
  
  <p>I get the error </p>
  
  <blockquote>
    <p>Missing '=' operator after key in hash literal</p>
  </blockquote>