title: Export-csv formatting. Powershell
body: <p>Let's start off by saying that I'm quite new to Powershell and not the greatest one working with it's code and scripts but trying to learn. And now to the problem!</p>
  
  <p>I'm working on a script that fetches information from computers in the network. I've got some code that works quite well for my purposes. But I'm having some problem when it comes to some information, mostly information that contains multiple objects, like service.</p>
  
  <pre><code>#This application will pull information from a list of devices. The devices list is
  sent with C:\Users\test.txt and output is pushed to a file C:\Users\devices.csv
  
  
  function kopiera
  {
  param
  (
      [Parameter(ValueFromPipeline=$true)]
      [string[]]$Computer=$env:computername
  )    
  Process
  {
      $computer | ForEach-Object{
  
          $service=Get-WmiObject -Class Win32_Service -Computername $_
  
  
          $prop= [ordered]@{
                      Service =$service.caption 
                  }
          New-Object PSCustomObject -Property   $prop
      }
  }
  }
  
  Get-Content C:\Users\test.txt | kopiera | Export-csv c:\Users\devices.csv
  </code></pre>
  
  <p>When I export the csv file it looks like this:</p>
  
  <p>TYPE System.Management.Automation.PSCustomObject</p>
  
  <p>"Service"</p>
  
  <p>"System.Object[]"</p>
  
  <p>So it doesn't fetch the service.caption (Because there are too many?).
  But If I replace the export-csv C:\Users\device.csv with out-file C:\Users\devices.txt it looks like this instead:</p>
  
  <p>{Adobe Acrobat Update Service, Adobe Flash Player Update Service, Andrea ADI Filters Service, Application Experience...}</p>
  
  <p>So it's starting to look better, but it doesn't get them all (Still because there are too many services?). What I'd like to do with this export/out-file is to get the information to appear vertically instead of horizontal.</p>
  
  <p>(Wanted result)</p>
  
  <p>Adobe Acrobat Service</p>
  
  <p>Adobe Flash Player Update Service</p>
  
  <p>and so on..</p>
  
  <p>instead of:
  (Actual result)</p>
  
  <p>Adobe Acrobat Update Service, Adobe Flash Player Update Service, and so on...</p>
  
  <p>Is there a way to make this possible, been trying for a while and can't wrap my brain around this.</p>
  
  <p>Any help is appreciated!</p>