title: Outputting a 2 column csv file using Powershell
body: <p>I have 2 .csv files I'm comparing and I'm saving the results in a text file using</p>
  
  <pre><code>Foreach(..data in dataSet..) {
      #Setting variables
  
    if("$samInitials" -eq "$ambInitials") {
  
      "$firstName $lastName`t$samName`n" | Add-Content $outputFile
  
      #$account = New-Object psobject -Property @{'Name'="$firstName $lastName"; 'SamName'="$samName"}
    }
    #$outputFile += $account
  }
  #$outputFile | Export-Csv $outputCSVPath -NoTypeInformation
  #commented out lines are the attempt to write to .csv file
  </code></pre>
  
  <p>How can I make (create a new if file doesn't exist) this append to a 2 column .csv file where column 1 is the <code>first &amp; last name</code> and column 2 is the <code>samName</code>? If its easier I can manually create the .csv and name the columns myself but I have no idea how to go about doing this.</p>
  
  <p>I'm literally brand new to Powershell so sorry if this is obvious but I've been working on this for the past 5 hours (aka since I've learned Powershell) and just need some help with this last step</p>