title: Adding new lines to Existing CSV using powershell?
body: <p>I wrote a script that would fetch all the services running under an account name.
  This part works fine except I want to add results to an existing csv. Add-content is messing up with my format. Please help as i am new here.</p>
  
  <p>script: </p>
  
  <pre><code>$servers = @("a", "b")
  $domain = "abc.com"
  
  foreach($server in $servers){
  
  $serverFQDN = $server+"."+"$domain"
      Invoke-Command -computername $serverFQDN{
          param($server)
          Write-host "On" + $server -ForegroundColor Yellow
          Get-WMIObject Win32_Service | Where-Object {$_.startname -match "ciqdev*" }
          # | where-object {$_.state -eq "running"}           
      }-argumentlist $server | select pscomputername,caption | export-Csv Z:\RT\myCSV.csv
  
  }
  </code></pre>