Forum Discussion
Assign selective license in Office 365 using Powershell - "Unable to assign this license ..."
If the user already has the same SKU assigned, you should not use the AddLicenses parameter, only the LicenseOptions one.
- Ian MoranDec 09, 2016Iron Contributor
Got it working. This enables all licenses in the SKU while leaving previously assigned licenses untouched.
PS C:\Users\Ian> $MyLicenseOptions = New-MsolLicenseOptions -AccountSkuId "mytenant:STANDARDWOFFPACK_FACULTY" -DisabledPlans $null
PS C:\Users\Ian> PS C:\Users\Ian> Set-MsolUserLicense -UserPrincipalName "user@domain.com" -LicenseOptions $MyLicenseOptions
- Eduardo Luis de Oliveira da SilvaOct 02, 2017Copper Contributor
Perfect,
This script helped me a lot, in assigning pending plans to users already licensed.
Thank you
- DeletedOct 23, 2017
Hi,
let's assume I want to only change the ProvisioningStatus of one ServicePlan and a
user has the following ServicePlans set ((Get-MsolUser -UserPrincipalName $user).Licenses.ServiceStatus)):
ServicePlan ProvisioningStatus
----------- ------------------
YAMMER_ENTERPRISE Success
OFFICESUBSCRIPTION Disabled
SHAREPOINTENTERPRISE SuccessI want to set YAMMER_ENTERPRISE to "Disabled"
So I tried:
$licenseOptions = New-MsolLicenseOptions -AccountSkuId "companyname:ENTERPRISEPACK"
-DisabledPlans "YAMMER_ENTERPRISE"Set-MsolUserLicense -UserPrincipalName $user -LicenseOptions $licenseOptions
What this does is set YAMMER_ENTERPRISE to "disabled", as expected. However, OFFICESUBSCRIPTION will now be enabled. I know this is because any ServicePlan not specified for -DisabledPlans will be enabled.
Is there an option to have every ServicePlan remain unchanged but desired one (here YAMMER_ENTERPRISE)?
I'm asking because if I wanted to automate this for a whole tenant it'd be devastating if all ServicePlans not specified for -DisabledPlans got enabled beacuse many times different users have different combinations of ServicePlans enabled/disabled and the should remain unchanged.
Thanks for your help in advance.
- Ian MoranDec 09, 2016Iron Contributor
Thanks Vasil, tried that by removing that parameter and it actually removed all licenses from the user
Set-MsolUserLicense -UserPrincipalName "user@domain.com" "tenantID:STANDARDWOFFPACK_FACULTY" -LicenseOptions $MyLicenseOptions