I am unable to sort a CSV properly. I have data in the following format:
File.csv:
Name,Application
user1,app1
user1,app1
user2,app1
user2,app2
...
I am able to get a list of users with more than one app1, more than one app2, but I cannot figure out how to get a list of users with app1 AND app2.
$users = Import-Csv file.csv
$users | ? {$_.Application -eq "app1" | Group Name | ? {$_.Count -gt 1} |
% {$_ | select -ExpandProperty group | select -first 1}
$users | ? {$_.Application -eq "app2" | Group Name | ? {$_.Count -gt 1} |
% {$_ | select -ExpandProperty group | select -first 1}
I'm not even sure on where to start for combining the two.