Microsoft Office 365 licenses include lots of products and services – Exchange, SharePoint, Teams, and so on. However, when organizations first adopt Office 365, many administrators disable some of these individual services. So how can you enable Office 365 license services later in an efficient manner? Enter PowerShell!
In this post, you will learn how to determine which Office 365 license services are disabled for a user and how to enable one or all of them using PowerShell.
For this tutorial, you will need:
- Administrator access to your Office 365 tenant, such as Global Administrator or User Administrator
- PowerShell (preferably 5.1, but you can use as low as version 2.0)
Installing and Connecting to Microsoft Online PowerShell
First, you need the MSOnline PowerShell module to manage user licenses. To install this module, open a PowerShell console (again, preferably version 5.1). Next, run the following command to install the MSOnline module:
Install-Module -Name MSOnline
If you receive a warning about installing from an untrusted repository, enter Y and press Enter to continue the installation. If you receive a warning about requiring administrator rights to install the module, use the following command to install the module at the current user scope:
Install-Module -Name MSOnline -Scope CurrentUser
To connect to the Microsoft 365 Online service, run the following command. PowerShell will prompt for the administrator username and password.
Connect-MsolService
If you want to learn how to connect to multiple Office 365 services, check out my article How to Connect to Office 365 PowerShell: Azure AD Modules.
Viewing Office 365 Licenses and Disabled Plans
Now that you are connected to Microsoft 365, you can view a user’s assigned licenses and any disabled service plans. Use the Get-MsolUser
command and specify the UserPrincipalName parameter. Save this to a variable named $user to view the properties of the user account.
$user = Get-MsolUser -UserPrincipalName <User Principal Name>
Next, view what licenses are assigned to the user by accessing the Licenses property the AccountSkuId property. In this example, this user has the ENTERPRISEPACK license assigned, which is the string identifier for an Office 365 E3 license. License names are also prepended with the name of the tenant. Document this AccountSkuId value as you will need it later.
For a complete list of product names and their string identifiers, check out this Microsoft Docs article.
$user.Licenses

Next, view what services are disabled by viewing the ServiceStatus property on the Licenses property. Note that two services are disabled: Microsoft Bookings and Yammer (screenshot does not reflect all services in the E3 license).
$user.Licenses.ServiceStatus

To focus on just the disabled plans, use the Where-Object to filter on the ProvisioningStatus property to find only the disabled plans.
$user.Licenses.ServiceStatus | `
Where-Object -Property ProvisioningStatus -EQ 'Disabled'

Enable All Disabled Office 365 Services
If you want to enable all disabled services, create a new License Options object using the New-MsolLicenseOptions
command. Specify the AccountSkuId property found in an earlier step, and save this to a variable named $licenseObject.
After that, use the Set-MsolUserLicense
command to assign the license object to the user account. Finally, view the enable service plans using the Get-MsolUser
command again and use dot notation to view the licenses and service status properties.
$licenseObject = New-MsolLicenseOptions -AccountSkuId <Account Sku Id>
Set-MsolUserLicense -UserPrincipalName <User Principal Name> `
-LicenseOptions $licenseObject
(Get-MsolUser -UserPrincipalName <User Principal Name>).Licenses.ServiceStatus

Enable Specific Disabled Office 365 Services
In the previous example, you enabled both Microsoft Bookings and Yammer by enabling all services associated with the license. In this next example, you will only enable Yammer while leaving Microsoft Bookings disabled. The steps are very similar with one minor change.
You still create the license object using the New-MsolLicenseOptions
command, but instead, you specify the MICROSOFTBOOKINGS service as disabled using the DisabledPlans parameter. To specify more than one plan to disable, separate the service plan names using commas. Follow the same steps as before by assigning this new license object to the user account.
$licenseObject = New-MsolLicenseOptions -AccountSkuId <Account Sku Id> `
-DisabledPlans "<Plan 1>", "<Plan 2>"
Set-MsolUserLicense -UserPrincipalName <User Principal Name> `
-LicenseOptions $licenseObject
(Get-MsolUser -UserPrincipalName <User Principal Name>).Licenses.ServiceStatus

Next Steps
In this tutorial, you learned how to install the MSOnline PowerShell module and connect to Microsoft 365 PowerShell. You viewed the license and service plans for a user account, and you enabled one or all service plans for a user.
For your next challenge, see if you can find all users with a specific license (or account SKU Id) and loop through those users to assign a new license object.
Enjoyed this article? Check out more of my PowerShell articles!