title: Export custom object to CSV
body: <p>I'm quite new to powershell and struggling with outputting data to a CSV file.
  I have a larger code piece but created the below small working example that contains the issue:</p>
  
  <pre><code>$results = @()
  $tmp_avs = @('tmp', 'tmp2')
  $hostname = 'hostname'
  $results += New-Object -TypeName PSObject -Property (@{Hostname=$hostname; avs=$tmp_avs})
  $res = $results | ? {$_.avs.Count -gt 0} | Format-Table
  
  $res | Export-Csv -NoTypeInformation "test.csv"
  </code></pre>
  
  <p>When printing the <code>$res</code> object above in PowerShell I get the output:</p>
  
  <pre>
  avs         Hostname
  ---         --------
  {tmp, tmp2} hostname
  </pre>
  
  <p>That is also the output I would like to receive in the CSV file, but currently I get something like this:</p>
  
  <pre>
  "ClassId2e4f51ef21dd47e99d3c952918aff9cd","pageHeaderEntry","pageFooterEntry","autosizeInfo","shapeInfo","groupingEntry"
  "033ecb2bc07a4d43b5ef94ed5a35d280",,,,"Microsoft.PowerShell.Commands.Internal.Format.TableHeaderInfo",
  "9e210fe47d09416682b841769c78b8a3",,,,,
  "27c87ef9bbda4f709f6b4002fa4af63c",,,,,
  "4ec4f0187cb04f4cb6973460dfe252df",,,,,
  "cf522b78d86c486691226b40aa69e95c",,,,,
  </pre>
  
  <p>Is there a possibility to export the <code>$res</code> object in a proper CSV format?</p>
  
  <p>EDIT:
  I removed the <code>Format-Table</code> now, which results in the following in the CSV format:</p>
  
  <pre>
  "avs","Hostname"
  "System.Object[]","hostname"
  </pre>
  
  <p>There is <code>System.Object[]</code> written instead of the values?</p>