Closed Ephesoft-Stitus closed 5 years ago
Turns out you can do it like this:
Update-GSUser -User $email -CustomSchemas @{ SSO = @{ role = @(@{type = 'work'; value = 'test'}, @{type = 'work'; value = 'test2'})}}
Hope this helps anybody else who is struggling with this.
Beat me to the punch, @Ephesoft-Stitus !!! Thanks for replying back with the fix and closing this out!! I'm glad you dig PSGSuite! 💓
This module is awesome, however, it doesn't seem currently possible to update a multi-valued custom schema field.
When I attempt to pass in a test I can error like this:
PS G:\My Drive\scripts> Update-GSUser -User $email -CustomSchemas @{SSO=@{role='test'}}
Update-GSUser : Exception calling "Execute" with "0" argument(s): "Google.Apis.Requests.RequestError Invalid Input: custom_schema [400] Errors [ Message[Invalid Input: custom_schema] Location[ - ] Reason[invalid] Domain[global] ] " At line:1 char:1
Ideally, a multi-valued field could be set by something like this (or something similar):
PS G:\My Drive\scripts> Update-GSUser -User $email -CustomSchemas @{SSO=@{role=@('value1', 'value2')}}
Here's a link to the API doc for custom schemas showing multi line value input: https://developers.google.com/admin-sdk/directory/v1/guides/manage-schemas