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 68 forks source link

Inconsistent Get-GSUser "IsEnrolledIn2Sv" field results when multiple users are returned #362

Closed jboiselle closed 2 years ago

jboiselle commented 2 years ago

Describe the bug When using Get-GSUser to query more than one user, the IsEnrolledIn2Sv field is sometimes inaccurate. If Get-GSUser is used to return a single user, the IsEnrolledIn2Sv field is always accurate.

As far as I can tell in my own testing, only the IsEnrolledIn2Sv field seems to be affected.

To Reproduce Run Get-GSUser in such a way that it returns multiple users, whether using -Filter, -SearchBase, etc:

PS > $googleUsers = Get-GSUser -Filter "isEnrolledIn2Sv=true"
PS > $googleUsers | ? {$_.User -eq 'user@issue.test'} | Select IsEnrolledIn2Sv

IsEnrolledIn2Sv
---------------
          False

Run Get-GSUser in such a way that it returns a single user:

PS > $googleUsers = Get-GSUser 'user@issue.test'
PS > $googleUsers | ? {$_.User -eq 'user@issue.test'} | Select IsEnrolledIn2Sv

IsEnrolledIn2Sv
---------------
           True

Expected behavior The IsEnrolledIn2Sv field should be consistent for each user regardless of returning a single user or multiple users.

Environment Tested on 3 different devices with the same results.

jboiselle commented 2 years ago

Tested this directly against Google's Directory API and saw the same issue. The users.list method returns different results than users.get. Will proceed to open a support case with them.