Bulk Enable Office 365 License Options

There are a number of online PowerShell resources which describe how to bulk assign an O365 license while enabling only certain service options.  In general, you would define the –DisabledPlans parameter using New-MsolLicenseOptions and assign the license using New-MsolUserLicense.  However, how do you go back and bulk enable a specific service option after the license has been assigned?

Let’s consider the following scenario… you have just completed a mail migration to O365 and all accounts were successfully licensed with only the Exchange option enabled.  Team Sites are now ready and you need to assign the SharePoint and Office Web Apps service for all users.  One option would be to simply enable all the remaining services in the license:

$Options = New-MsolLicenseOptions –AccountSkuId "tenant:ENTERPRISEPACK"

Set-MsolUserLicense –UserPrincipalName [UPN] –LicenseOptions $Options

Notice the absence of –AddLicenses parameter from the Set-MsolUserLicense cmdlet.  Trying to add a license that is already assigned results in an error.  Therefore, we simply enable all the other service options contained within the license.  Another method might be to remove the currently assigned license and re-apply it using the desired service options.  However, there is risk associated with removing a license.  The existing Exchange mailbox could become orphaned and an empty one re-provisioned.  Also, any related O365 service data associated with the user account might be lost.

Now, let’s consider a similar but slightly more complicated scenario. User accounts each have an inconsistent mix of service options enabled; some have SharePoint enabled, some have Lync enabled, and not all have Exchange.  How do you assign the Office subscription (for example) to all accounts?  You can’t blindly enable all remaining options, as this would provide access to services which may not be desired.  Removing the license and re-applying it also proves difficult. The solution is to query each user accounts to determine which service options are currently active or inactive, add the service you would like to enable, and assign the results.  (NOTE: This is written for E3 license, but easily adapted for other SKUs.)

First, we'll create a data set to run against.  I typically prefer using a CSV import file when making bulk changes, but the task could also be run against all licensed accounts:

Import-Csv c:\o365\AssignOption.csv | ForEach {

#Get-MsolUser –All | Where { $_.IsLicensed –eq $true } | ForEach {

$Upn = $_.UserPrincipalName

Let’s initially assume all service options for the user are currently disabled:

$Exchange = "Disabled"; $SharePoint = "Disabled"; $Lync = "Disabled"; $Office = "Disabled"; $WebApps = "Disabled"

We retrieve the assigned license and make note of which options are actually enabled for the user:

(Get-MsolUser -User $Upn).Licenses[0].ServiceStatus | ForEach {

If ($_.ServicePlan.ServiceName -eq "EXCHANGE_S_ENTERPRISE" –and $_.ProvisioningStatus -ne "Disabled" { $Exchange = "Enabled" }

If ($_.ServicePlan.ServiceName -eq "SHAREPOINTENTERPRISE" –and $_.ProvisioningStatus -ne "Disabled") { $SharePoint = "Enabled" }

If ($_.ServicePlan.ServiceName -eq "MCOSTANDARD" –and $_.ProvisioningStatus -ne "Disabled") { $Lync = "Enabled" }

If ($_.ServicePlan.ServiceName -eq "OFFICESUBSCRIPTION" –and $_.ProvisioningStatus –ne "Disabled") { $Office = "Enabled" }

If ($_.ServicePlan.ServiceName -eq "SHAREPOINTWAC" -and $_.ProvisioningStatus -ne "Disabled") { $WebApps = "Enabled" } }

Next, we create an array and populate the variable with the results from the license audit.  In this example, Office is not added as a disabled option since we will be enabling this service for all users:

$DisabledOptions = @()

If ($Exchange -eq "Disabled") { $DisabledOptions += "EXCHANGE_S_ENTERPRISE" }

If ($SharePoint -eq "Disabled") { $DisabledOptions += "SHAREPOINTENTERPRISE" }

If ($Lync -eq "Disabled") { $DisabledOptions += "MCOSTANDARD" }

#If ($Office -eq "Disabled") { $DisabledOptions += "OFFICESUBSCRIPTION" }

If ($WebApps -eq "Disabled") { $DisabledOptions += "SHAREPOINTWAC" }

Now we can create the license option variable which assigns all services except those that were not already enabled:

$LicenseOptions = New-MsolLicenseOptions –AccountSkuId "tenant:ENTERPRISEPACK" –DisabledPlans $DisabledOptions

And finally, we apply the license to the user account:

       Set-MsolUserLicense –User $Upn –LicenseOptions $LicenseOptions

These same concepts can be used in a number of different scenarios for which only certain O365 license options must be bulk enabled.  For a more complex scenario and some advanced license reconciliation concepts, please refer to Bulk Migrate Office 365 Licenses.  RjZ

UPDATE:  I received feedback that this script may not work properly when more than one license or stand-alone SKU is assigned.  Therefore, I have revised it to detect and evaluate the E3 license only, even if other SKUs are assigned.  This is easily changed in the script to look for other SKUs too.  I have also included logic for Yammer.


Comments (16)

  1. Yatin says:

    While you are saying that this is easily adapted to other plans, I am unable to make it work for Microsoft Office 365 Plan A2 for Students. I will be obliged if you can post an script for that plan. Note that we want to disable Exchange Online (Plan 1) for Students license and enable all licenses / components in Microsoft Office 365 Plan A2 for Students. Thanks.

  2. aaron says:


    The licensing for Education customers has different SKU/service plan names.  For example, I did this for one of my EDU customers that wanted to take back SharePoint and Lync licensing (leaving them with only Exchange Online):

    $EnabledUsers = Get-MsolUser -All | Where-Object { $_.IsLicensed -eq "TRUE" } | Select-Object UserPrincipalName

    $ServicePlans = Get-MsolAccountSku | Where {$_.SkuPartNumber -eq "STANDARDWOFFPACK_FACULTY"}


    ForEach ($line in $EnabledUsers) {

           Write-Host $Line.UserPrincipalName

           Set-MsolUserLicense -UserPrincipalName $Line.UserPrincipalName -LicenseOptions $OnlyExchangeOnline }

    You'll have to get a list of what the service plans the students are currently licensed for.  You'll probably need to use the -RemoveLicense and -AddLicense parameters in the same cmdlet to preserve their existing mailboxes if you need to maintain that data.

  3. Tiago Ferretti says:


    There is the possibility of the script to generate a log file with the name of each user and each user operation was successful or not?

    I thank you!

  4. To easily generate a log file each time you run the script, you just have to insert the Start-Transcript cmdlet at the beginning of the script and then Stop-Transcript at the end.

    This will automatically create a log file containing the script output on your Documents folder.

  5. BobEadie says:

    Great – I've been looking for ages for how to enable the LYNC feature for users who already have a licence – and your article is precisely it EXCEPT a minor misprint . . .

    NewMsolLicenseOptions should have a dash in it


    Thanks, Bob

  6. Anonymous says:

    I was asked by several customers what are some of the new SKU names they can use and where can they find

  7. Anonymous says:

    I was asked by several customers what are some of the new SKU names they can use and where can they find

  8. Anonymous says:

    First read this post carefully:

    Now a little explanation and step by step:

    Type "Get-MsolAccountSku" at the command prompt to find out your AccountSkuId. When you do, you might see output like this:


  9. Me says:

    Very nice article! Thank you for the help!

  10. Chris says:

    Excellent! Saved me a lot of time

  11. Pereira says:

    Very nice article! Thank you for the help!

  12. james says:

    Hi There, We recently rolled out Exchange O365 to our users. I am very new to this and we are now looking to do the same for Skype. Is there any example of the csv data available that goes with this or is it just a list of UPNs in a csv?

  13. Ron Steurer says:

    thank you very much. this helped me figure out in just adding the last service plan (Exchange_S_Standard) to accounts that already had all other options minus Exchange online. It seems so simple now but up until now I was creating a variable with what
    I wanted disabled of course but when I wanted everything I was stuck. thank you again for taking the time to post!! Cheers!

  14. Diana Phillips says:

    Very helpful! Thank you! This helped me find the right syntax to re-enable Yammer service within the E3 licenses for a specific department. Thanks so much for sharing! 🙂

  15. Mark says:

    Thanks for the article, I have been trying to figure this out for quite some time and finally have hope! A quick question – when you say:

    Let’s initially assume all service options for the user are currently disabled:

    $Exchange = "Disabled"; $SharePoint = "Disabled"; $Lync = "Disabled"; $Office = "Disabled"; $WebApps = "Disabled"

    What exactly do you mean? Why would we assume that in a scenario where we are specifically assuming that the user has SOME service options enabled?

    My specific scenario, I have a .csv file of users who need Exchange Online enabled, but some already have SharePoint, some already have Yammer, some already have Sway – I need to read their current licenses, add Exchange Online, and NOT mess up their current
    licenses… and if any already have Exchange online they can just be ignored… does this make sense?

Skip to main content