title: How can you select unique objects based on two properties of an object in powershell?
body: <p>I have an array of Objects that have 6 properties. That look like this:</p>
  
  <pre><code>$csvData
  CURRENT DATE AND TIME : 07/10/2015 08:17:17 CST
  USER NAME             : userName
  COMPUTER NAME         : computerName
  IP ADDRESS            : 192.168.1.1
  LOGON SERVER          : logonServer
  LOGON/OFF             : logon
  </code></pre>
  
  <p>I want to create an array of objects where username and computer name are not duplicated. How can I get only the unique username/computername combo in powershell? Ultimately I would like to remove all duplicates and add a property 'Count' that keeps track of how many duplicates there are. </p>
  
  <p>I have tried:</p>
  
  <pre><code>$csvDataUnique = $csvData | Select-Object 'User Name','Computer Name' -Unique
  $csvDataUnique = $csvData | sort -Property 'User Name' | Get-Unique
  </code></pre>