title: How to export data to CSV in PowerShell?
body: <pre><code>foreach ($computer in $computerlist) {
      if((Test-Connection -Cn $computer -BufferSize 16 -Count 1 -ea 0 -quiet))
      {
          foreach ($file in $REMOVE) {
              Remove-Item "\\$computer\$DESTINATION\$file" -Recurse
              Copy-Item E:\Code\powershell\shortcuts\* "\\$computer\$DESTINATION\"            
          }
      } else {
          Write-Host "\\$computer\$DESTINATION\"
      }
  }
  </code></pre>
  
  <p>I want to export Write-Host "\$computer\$DESTINATION\" to the CSV files so I know which computers were offline when the script ran.</p>
  
  <p>I am running this from a Windows 7 machine</p>