12-08-2016 12:07 PM
12-08-2016 12:07 PM
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 "email@example.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 "firstname.lastname@example.org" -AddL ...
+ CategoryInfo : OperationStopped: (:) [Set-MsolUserLicense], MicrosoftOnlineException
+ FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.InvalidUserLicenseException,Microsoft.Online.Administration.Automation.SetUserLic
PS D:\Office365-Powershell> Get-MsolAccountSku
AccountSkuId ActiveUnits WarningUnits ConsumedUnits
------------ ----------- ------------ -------------
tenantID:STANDARDWOFFPACK_FACULTY 500720 0 760
12-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.
12-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 "email@example.com" "tenantID:STANDARDWOFFPACK_FACULTY" -LicenseOptions $MyLicenseOptions
12-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 "firstname.lastname@example.org" -LicenseOptions $MyLicenseOptions
10-02-2017 01:49 PM
This script helped me a lot, in assigning pending plans to users already licensed.
10-23-2017 01:46 AM - edited 10-23-2017 01:49 AM
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):(
I want to set YAMMER_ENTERPRISE to "Disabled"
So I tried:
$licenseOptions = New-MsolLicenseOptions -AccountSkuId "companyname:ENTERPRISEPACK"
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.
10-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.
10-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.
10-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.
10-24-2017 02:09 AM
Remember that license assignment can now be handled by Azure AD Groups - much more convenient