Quantcast
Channel: General Office Development forum
Viewing all articles
Browse latest Browse all 2257

Assigning Office 365 Licence with Powershell - Error

$
0
0

Im trying to add an Office365 licence to a user with powershell and get an error:

Set-MsolUserLicense : Unable to assign this license because it is invalid. Use the Get-MsolAccountSku cmdlet to retrieve a list of valid licenses.

I can connect to the tenant and retrieve licences successfully with Get-MsolAccountSku and have plenty available.

AccountSkuId                         ActiveUnits WarningUnits ConsumedUnits
------------                         ----------- ------------ -------------          
reseller-account:STANDARDPACK        162         0            154

User does not currently have a licence assigned.

Script i am running is:

$license = "tenantname:STANDARDPACK"
$LicenseOptions = New-MsolLicenseOptions -AccountSkuId $license -DisabledPlans POWERAPPS_O365_P1
Set-MsolUserLicense -UserPrincipalName "testman@osmoflo.com" -AddLicenses $license -LicenseOptions $LicenseOptions


Viewing all articles
Browse latest Browse all 2257

Trending Articles