PSGSuite icon indicating copy to clipboard operation
PSGSuite copied to clipboard

Set-GSUserLicense

Open lucafabbri365 opened this issue 4 years ago • 4 comments

Hello, I'm trying to set a G Suite Lite license for a user. If I run this cmdlet, it works fine:

Set-GSUserLicense -User <PrimaryEmail> -License G-Suite-Lite

...but if I run these other two cmdlets I get different errors:

Set-GSUserLicense -User <PrimaryEmail> -License gsuitelite

Error:

Set-GSUserLicense : Exception calling "Execute" with "0" argument(s): "Parameter validation failed for "skuId""
At line:1 char:1
+ Set-GSUserLicense -User <PrimaryEmail> -License gsuitelite
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Set-GSUserLicense

Set-GSUserLicense -User <PrimaryEmail> -License Google-Apps-Lite

Error:

Set-GSUserLicense : Cannot validate argument on parameter 'License'. The argument "Google-Apps-Lite" does not belong
to the set "16tb,1tb,200gb,20gb,2tb,400gb,4tb,50gb,8tb,basic,businessarchived,cdm,chrome,cloudidentity,Cloud-Identity,c
loudidentitypremium,Cloud-Identity-Premium,coordinate,d4e,drive16tb,drive1tb,drive200gb,drive20gb,drive2tb,drive400gb,d
rive4enterprise,drive4tb,drive50gb,drive8tb,driveenterprise,Drive-Enterprise,e4e,e4es,enterprise,enterprisearchived,fre
e,gae,gafb,gafg,gafw,gal,gams,gau,googlechromedevicemanagement,Google-Chrome-Device-Management,googlecoordinate,Google-
Coordinate,googledrivestorage16tb,Google-Drive-Storage-16TB,googledrivestorage1tb,Google-Drive-Storage-1TB,googledrives
torage200gb,Google-Drive-Storage-200GB,googledrivestorage20gb,Google-Drive-Storage-20GB,googledrivestorage2tb,Google-Dr
ive-Storage-2TB,googledrivestorage400gb,Google-Drive-Storage-400GB,googledrivestorage4tb,Google-Drive-Storage-4TB,googl
edrivestorage50gb,Google-Drive-Storage-50GB,googledrivestorage8tb,Google-Drive-Storage-8TB,googlevault,Google-Vault,goo
glevaultformeremployee,Google-Vault-Former-Employee,googlevoicepremier,Google-Voice-Premier,googlevoicestandard,Google-
Voice-Standard,googlevoicestarter,Google-Voice-Starter,gsb,gsbau,gse,gseau,gsefe,gsefes,gsl,gsuitebasic,G-Suite-Basic,g
suitebusiness,G-Suite-Business,gsuitebusinessarchived,G-Suite-Business-Archived,gsuiteenterprise,G-Suite-Enterprise,gsu
iteenterprisearchived,G-Suite-Enterprise-Archived,gsuiteenterpriseeducation,gsuiteenterpriseeducationstudent,G-Suite-En
terprise-for-Education,G-Suite-Enterprise-for-Education-Student,G-Suite-Free-Standard,gsuitegams,gsuitegov,gsuitegovern
ment,G-Suite-Government,gsuitelite,G-Suite-Lite,gsuitemessagesecurity,G-Suite-Message-Security,gsuitepostini,gvpremier,
gvstandard,gvstarter,identity,identitypremium,lite,postini,standard,unlimited,vault,vfe,voicepremier,voicestandard,voic
estarter" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
At line:1 char:60
+ ... UserLicense -User <PrimaryEmail> -License Google-Apps-Lite
+                                                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Set-GSUserLicense], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Set-GSUserLicense

Questions:

  1. Why the gsuitelite value, even if included in ValidateSet list, is not a valid value ?
  2. According to these two Google Developers pages Google Product and SKU IDs and G Suite Reseller API the Google-Apps-Lite is a valid SKU ID, but not included in ValidateSet list, why ? Where the ValidateSet list values come from ?

Thank you, Luca

lucafabbri365 avatar Jun 18 '20 22:06 lucafabbri365

Hey @lucafabbri365 - Those values come from primarily GAMADV-X's list for the same purpose, as their list contains products/sku's not documented and including the same aliases enables easier transition from GAM to PSGSuite.

Checking out why Google-Apps-Lite isn't listed as it's definitely on the source list.

scrthq avatar Jun 27 '20 20:06 scrthq

Alright so they should all be resolving correctly, but obviously that's not happening. Here's replication by using the internal private functions directly; only the G-Suite-Lite value resolves:

image

Checking this out further, thanks for finding this!

scrthq avatar Jun 30 '20 04:06 scrthq

Got it sorted out, it was only caching the cleaned-up Display Name of the SKU, so valid lookups using the actual name (Google-Apps-Lite) or an alias (gsuitelite) weren't resolving to anything, resulting in the errors you saw. It will be in the next release, keeping this open until it's pushed.

scrthq avatar Jun 30 '20 04:06 scrthq

Hello @scrthq, thank you for your feedback. I'm waiting for the latest release.

Regards, Luca

lucafabbri365 avatar Jul 01 '20 23:07 lucafabbri365