I have an array of objects with 6 properties. It looks like this:
$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
I want to create an array of objects where the username and computer name are not duplicated. How can I get only the unique username / computer_name in powershell? Ultimately, I would like to remove all duplicates and add the “Count” property, which keeps track of the number of duplicates.
I tried:
$csvDataUnique = $csvData | Select-Object 'User Name','Computer Name' -Unique
$csvDataUnique = $csvData | sort -Property 'User Name' | Get-Unique
source
share