I have a list of users their device(s) and their managers. The manager and user can be duplicates but the deviceID is unique. How do I get a list so I can send every manager an email to let them know how many and which unit their employees are using? I am only interested in people with 2 or more devices.
Wanted output would be something like this (if anyone wants to give me a better output suggestion I am all ears).
Manager deviceID
M1 U1=D1 D2, U3=D4 D5
What my code looks like now:
$csv = @"
manager,user,deviceID
M1,U1,D1
M1,U1,D2
M2,U2,D3
M1,U3,D4
M1,U3,D5
"@ -split "`r`n" | ConvertFrom-Csv
$csv | Group-Object -Property Manager |
Select-Object @{N='Manager';E={($_.Group[0]).Manager}},
@{N="User";E={($_.group).user}},
@{N="deviceID";E={ foreach($row in $_.Group){ $row.user + ' = ' + $row.deviceID}}}