Dec 08 2016
12:07 PM
- last edited on
Feb 07 2023
07:47 PM
by
TechCommunityAP
Dec 08 2016
12:07 PM
- last edited on
Feb 07 2023
07:47 PM
by
TechCommunityAP
I'm attempting to assign Yammer licenses to all users in the tenant who don't have this assigned. All users have location set and have at least an Exchange license from the STANDARDWOFFPACK_FACULTY SKU
I'm running the following for one user (as a test) - who doesn't have a Yammer license - (excludes YAMMER_EDU from the list of licenses) - but it fails with the error message below.
Can anyone help please ?
PS D:\Office365-Powershell> $MyLicenseOptions = New-MsolLicenseOptions -AccountSkuId "tenantID:STANDARDWOFFPACK_FACULTY" -DisabledPlans FLOW_O365_P2, POWERAPPS_O365_P2, RMS_S_ENTERPRISE, OFFICE_FORMS_PLAN_2, PROJECTWORKMANAGEMENT, SWAY, INTUNE_O365, SHAREPOINTWAC_EDU, MCOSTANDARD, SHAREPOINTSTANDARD_EDU, EXCHANGE_S_STANDARD
PS D:\Office365-Powershell> Set-MsolUserLicense -UserPrincipalName "user@domain.com" -AddLicenses "tenantID:STANDARDWOFFPACK_FACULTY" -LicenseOptions $MyLicenseOptions
Set-MsolUserLicense : Unable to assign this license because it is invalid. Use the Get-MsolAccountSku cmdlet to retrieve a list of valid licenses.
At line:1 char:1
+ Set-MsolUserLicense -UserPrincipalName "user@domain.com" -AddL ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [Set-MsolUserLicense], MicrosoftOnlineException
+ FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.InvalidUserLicenseException,Microsoft.Online.Administration.Automation.SetUserLic
ense
PS D:\Office365-Powershell> Get-MsolAccountSku
AccountSkuId ActiveUnits WarningUnits ConsumedUnits
------------ ----------- ------------ -------------
tenantID:STANDARDWOFFPACK_FACULTY 500720 0 760
Dec 08 2016 11:38 PM
If the user already has the same SKU assigned, you should not use the AddLicenses parameter, only the LicenseOptions one.
Dec 09 2016 01:03 AM
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
Dec 09 2016 06:56 AM
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
Oct 02 2017 01:49 PM
Perfect,
This script helped me a lot, in assigning pending plans to users already licensed.
Thank you
Oct 23 2017 01:46 AM - edited Oct 23 2017 01:49 AM
Oct 23 2017 01:46 AM - edited Oct 23 2017 01:49 AM
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 Success
I 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.
Oct 23 2017 10:13 AM
The cmdlets overwrite the service settings, they do not add/remove services. So when you setup the $licenseoptions variable, set both Yammer and Office to disabled. This script shows how you can do this in bulk for all users, respecting their enabled/disabled services.
Oct 23 2017 11:02 PM
Thanks. So do you agree that there's no convenient way to selectively enable/disable certain services so that we can treat users that have different combinations of services in bulk?
I imagine if one were to do some more elaborate scripting it might be possible. Unfortunately, this is out of my ability.
Oct 23 2017 11:40 PM
The script I linked to is convenient enough for me :) It might take some adjustments to better fit your needs, but it's definitely possible to bulk edit licenses with it, while respecting the individual service status.
Oct 24 2017 02:09 AM
Remember that license assignment can now be handled by Azure AD Groups - much more convenient