Share via


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.

Enable-LicenseOptions.zip

Comments

  • Anonymous
    August 14, 2013
    The comment has been removed

  • Anonymous
    August 15, 2013
    The comment has been removed

  • Anonymous
    September 25, 2013
    Hello, 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!

  • Anonymous
    October 23, 2013
    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.

  • Anonymous
    November 20, 2013
    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 New-MsolLicenseOptions. Thanks, Bob

  • Anonymous
    February 05, 2014
    I was asked by several customers what are some of the new SKU names they can use and where can they find

  • Anonymous
    February 07, 2014
    I was asked by several customers what are some of the new SKU names they can use and where can they find

  • Anonymous
    June 05, 2014
    Great info RJZ

  • Anonymous
    July 03, 2014
    First read this post carefully:
    Link

    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:

    AccountSkuId

  • Anonymous
    November 17, 2014
    Very nice article! Thank you for the help!

  • Anonymous
    November 26, 2014
    Excellent! Saved me a lot of time

  • Anonymous
    February 19, 2015
    Very nice article! Thank you for the help!

  • Anonymous
    November 06, 2015
    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?

  • Anonymous
    November 10, 2015
    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!

  • Anonymous
    March 23, 2016
    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! :-)

  • Anonymous
    March 25, 2016
    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?