title: Formatting tables in PowerShell to export as CSV
body: <p>I'm seriously sleep deprived and stressed so it is probably extremely simple yet I still can't manage to figure it out.</p>
  
  <p>I want to get an export of various things like services, processes, firewallrules, local users, whatever I need as a CSV but whenever I export it as such the csv only has 1 column in Excel when I open it.</p>
  
  <p>I just want the output to be separated by columns so I can have a simple overview in Excel.</p>
  
  <pre><code>Get-Service | Sort-Object Status | Format-Table -AutoSize | Out-String -Width 10000 | Out-File -Append "C:\temp\Test.csv"
  </code></pre>
  
  <p>But this is the output I get:
  <a href="https://i.stack.imgur.com/dJsOn.png" rel="nofollow noreferrer">Services</a></p>
  
  <p>This is what happens if I use a Export-CSV CMD: <a href="https://i.stack.imgur.com/opxeq.png" rel="nofollow noreferrer">Services</a></p>