title: Merge/output Unique values of two CSVs using Powershell
body: <p>I'm trying to find unique values/merge two CSVs. But it doesn't seem to be working. </p>
  
  <p>For some reason the code doesn't return unique values (doesn't merge). The output is always the values of the first CSV. In this case it's returning the values of <code>$Users1</code>. If i change it to <code>$UserUnique = $Users2 + $user1</code> it returns the values of <code>$User2</code></p>
  
  <p>Here's my code: </p>
  
  <pre><code>$Users1 = Import-Csv -Path \\share\user\Desktop\disabledusers.csv
  $Users2 = Import-Csv -Path \\share\user\Desktop\disabledusers2.csv
  
  $UserUnique = $Users1 + $user2
  $UserUnique | Select-Object -Property * -Unique
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Thanks in advance. </p>
  
  <p>My Ref link - <a href="https://stackoverflow.com/questions/38341514/how-to-merge-two-csv-files-in-powershell-with-same-headers-and-discard-duplicate/38342333#38342333">How to merge two csv files in powershell with same headers and discard duplicate rows</a></p>
  
  <p>More information as requested: Please find the CSVs and expected outcome attached below. </p>
  
  <p>$Users1</p>
  
  <pre>
  name    lastlogondate   passwordlastset SAMAccountName  
  Name1   20/03/2017 12:54    05/09/2013 13:43    Sam1    
  Name2   18/08/2016 10:31    04/03/2015 09:42    Sam2    
  Name3   11/09/2016 17:48    17/03/2015 12:02    Sam3    
  Name4   06/09/2016 08:46    06/10/2015 09:44    Sam4    
  Name5   07/09/2016 08:46    07/10/2015 09:44    Sam5    
  Name6   08/09/2016 08:46    08/10/2015 09:44    Sam6    
  </pre>
  
  <p>$Uers2</p>
  
  <pre>
  name    lastlogondate   passwordlastset SAMAccountName
  Name1   20/03/2017 12:54    05/09/2013 13:43    Sam1
  Name2   18/08/2016 10:31    04/03/2015 09:42    Sam2
  Name3   11/09/2016 17:48    17/03/2015 12:02    Sam3
  Name4   06/09/2016 08:46    06/10/2015 09:44    Sam4
  Name7   09/09/2016 08:46    09/10/2015 09:44    Sam7
  Name8   10/09/2016 08:46    10/10/2015 09:44    Sam8
  Name9   11/09/2016 08:46    11/10/2015 09:44    Sam9
  Name10  12/09/2016 08:46    12/10/2015 09:44    Sam10
  </pre>
  
  <p>Expected Outcome</p>
  
  <pre>
  name    lastlogondate   passwordlastset SAMAccountName
  Name1   20/03/2017 12:54    05/09/2013 13:43    Sam1
  Name2   18/08/2016 10:31    04/03/2015 09:42    Sam2
  Name3   11/09/2016 17:48    17/03/2015 12:02    Sam3
  Name4   06/09/2016 08:46    06/10/2015 09:44    Sam4
  Name5   07/09/2016 08:46    07/10/2015 09:44    Sam5
  Name6   08/09/2016 08:46    08/10/2015 09:44    Sam6
  Name7   09/09/2016 08:46    09/10/2015 09:44    Sam7
  Name8   10/09/2016 08:46    10/10/2015 09:44    Sam8
  Name9   11/09/2016 08:46    11/10/2015 09:44    Sam9
  Name10  12/09/2016 08:46    12/10/2015 09:44    Sam10
  </pre>