SCRT-HQ / PSGSuite

Powershell module for Google / G Suite API calls wrapped in handy functions. Authentication is established using a service account via P12 key to negate the consent popup and allow for greater handsoff automation capabilities
https://psgsuite.io/
Apache License 2.0
234 stars 66 forks source link

Get G Suite user by mobile device #289

Closed lucafabbri365 closed 4 years ago

lucafabbri365 commented 4 years ago

Hello, I was wondering if it would be possible to retrieve G Suite user information, by the list of pending mobile devices, in a different way rather than using, for example:

GSMobileDevice -Filter "status:pending" | %{Get-GSUser -Filter "name:$($_.Name)"}

But, the above isn't so good if there are multiple users with same 'Name'. I can see only two properties Email (containing multiple values/aliases) and Name that could be passed to Get-GSUser. I could also retrieve only one e-mail address (Email property) for each mobile device and pass it to Get-GSUser cmdlet:

GSMobileDevice -Filter "status:pending" | Select-Object @{L="Email";E={$_.Email | Select-Object -First 1}} | Get-GSUser

Anything else ?

Thank you, Luca