title: Export-CSV formatting carriage returns
body: <p>I'm retrieving information from the active directory but when I try to export it with <code>Export-CSV</code> there are some issues with the carriage returns. It's starting a new line in the CSV-file for each return it finds, while it should actually stay on the current line.</p>
  
  <pre><code>$User = Get-ADUser Bob -Properties *
  Display name    : Bob Smith
  Notes           : Line 1
                    Line 2
                    Line 3
  E-mail          : Bob.Smith@company.com
  
  $User | Export-CSV 'C:\file.csv'
  Display name, Notes, E-mail
  Bob Smith, Line 1
  Line 2
  Line 3
  Bob.Smith@company.com
  </code></pre>
  
  <p>How can I have the following output?</p>
  
  <pre><code>$User | Export-CSV 'C:\file.csv'
  Display name, Notes, E-mail
  Bob Smith, Line 1 Line 2 Line 3, Bob.Smith@company.com
  </code></pre>
  
  <p>I've tried with encoding, other delimiters, .. Can't really figure this one out.</p>
  
  <p><strong>Solution</strong></p>
  
  <pre><code>$User | Select 'Display Name', @{l='Notes';e={$_.Notes -replace "`n"," "}}, E-mail | Export-Csv 'C:\file.csv' -NoTypeInformation -Delimiter ';'
  </code></pre>