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
235 stars 67 forks source link

Update-GSUser does not accept unique ID's as the User value #210

Closed scrthq closed 5 years ago

scrthq commented 5 years ago

Received via email. Issue is that Update-GSUser is not using the Resolve-Email private function, quick fix.

Steps to reproduce:

PS > $id = (Get-GSUser $testUser).Id
PS > Update-GSUser -User $id -ExternalIds (Add-GSUserExternalId -Type organization -Value 'my org')

Confirm
Are you sure you want to perform this action?
Performing the operation "Update-GSUser" on target "Updating user '12345678901234567890@domain.com'".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): A
VERBOSE: Updating user '12345678901234567890@domain.com'
Get-GSUser : Exception calling "Execute" with "0" argument(s): "Google.Apis.Requests.RequestError
Resource Not Found: userKey [404]
Errors [
        Message[Resource Not Found: userKey] Location[ - ] Reason[notFound] Domain[global]
]
"
At C:\Users\nate\Documents\PowerShell\Modules\PSGSuite\2.28.2\PSGSuite.psm1:27152 char:32
+                     $userObj = Get-GSUser $U -Verbose:$false
+                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-GSUser

Update-GSUser : Exception calling "Execute" with "0" argument(s): "Parameter validation failed for "userKey""
At line:1 char:1
+ Update-GSUser -User $id -ExternalIds (Add-GSUserExternalId -Type orga ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Update-GSUser
scrthq commented 5 years ago

deployed!