View account license and service details with Office 365 PowerShell

Summary: Explains how to use Office 365 PowerShell to determine the Office 365 services that have been assigned to users.

In Office 365, licenses from licensing plans (also called SKUs or Office 365 plans) give users access to the Office 365 services that are defined for those plans. However, a user might not have access to all the services that are available in a license that's currently assigned to them. You can use Office 365 PowerShell to view the status of services on user accounts.

Before you begin

  • The procedures in this topic require you to connect to Office 365 PowerShell. For instructions, see Connect to Office 365 PowerShell.

  • Use the commands Get-MsolAccountSku and (Get-MsolAccountSku | where {$_.AccountSkuId -eq '<AccountSkuId>'}).ServiceStatus to find the following information:

    • The licensing plans that are available in your organization.

    • The services that are available in each licensing plan, and the order in which they are listed (the index number).

      For more information about licensing plans, license, and services, see View licenses and services with Office 365 PowerShell.

  • Use the command Get-MsolUser -UserPrincipalName <user account UPN> | Format-List DisplayName,Licenses to find the licenses that are assigned to a user, and the order in which they are listed (the index number).

  • If you use the Get-MsolUser cmdlet without using the All parameter, only the first 500 accounts are returned.

The short version (instructions without explanations)

To view all the Office 365 PowerShell services that a user has access to, use the following syntax:

(Get-MsolUser -UserPrincipalName <user account UPN>).Licenses[<LicenseIndexNumber>].ServiceStatus

This example shows the services to which the user BelindaN@litwareinc.com has access. This shows the services that are associated with all licenses that are assigned to her account.

(Get-MsolUser -UserPrincipalName belindan@litwareinc.com).Licenses.ServiceStatus

This example shows the services that user BelindaN@litwareinc.com has access to from the first license that's assigned to her account (the index number is 0).

(Get-MsolUser -UserPrincipalName belindan@litwareinc.com).Licenses[0].ServiceStatus

To find all the licensed users who have been enabled or not enabled for specific services, use the following syntax:

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[<LicenseIndexNumber> ].ServiceStatus[<ServiceIndexNumber> ].ProvisioningStatus <-eq | -ne> "Disabled" -and $_.Licenses[<LicenseIndexNumber> ].ServiceStatus[<ServiceIndexNumber> ].ProvisioningStatus <-eq | -ne> "Disabled"...}

These examples use the following information:

  • The license that gives access to the Office 365 services that we're interested in is the first license that's assigned to all users (the index number is 0).

  • The Office 365 services that we're interested in are Skype for Business Online and Exchange Online. For the licenses that are associated with the licensing plan, Skype for Business Online is the 6th service listed (the index number is 5), and Exchange Online is the 9th service listed (the index number is 8).

This example returns all licensed users who are enabled for Skype for Business Online and Exchange Online.

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[5].ProvisioningStatus -ne "Disabled" -and $_.Licenses[0].ServiceStatus[8].ProvisioningStatus -ne "Disabled"}

This example returns all licensed users who aren't enabled for Skype for Business Online or Exchange Online.

Get-MsolUser -All | where {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[5].ProvisioningStatus -eq "Disabled" -and $_.Licenses[0].ServiceStatus[8].ProvisioningStatus -eq "Disabled"}

The long version (instructions with detailed explanations)

Find the Office 365 PowerShell services that a user has access to

It's obviously important for you to know which users have been issued Office 365 licenses and which users haven't. (See the article View licensed and unlicensed users with Office 365 PowerShell for more information). However, simply having an Office 365 license doesn't tell you anything about what that user can actually do with Office 365. Can he or she use Exchange Online or Skype for Business Online? Can this user access SharePoint Online? Does he or she have access to Office Professional Plus? Having a license simply means that the user has the potential to access these services. However, the capabilities available to a user depend on the services that have been enabled on his or her license.

So how can we determine which Office 365 features a user has access to? To do that we need to run a command similar to this one:

Get-MsolUser -UserPrincipalName BelindaN@litwareinc.com | Select-Object -ExpandProperty Licenses | Select-Object -ExpandProperty ServiceStatus

In this command, we're using the Get-MsolUser cmdlet to return information about the account BelindaN@litwareinc.com. Once we've returned that information, we then pipe the account data to the Select-Object cmdlet and ask Select-Object to "expand" the value of the Licenses property:

Select-Object -ExpandProperty Licenses

Why do we do that? Well, by default the Licenses property only tells us the name of the licensing pack where Belinda's license came from:

Licenses
--------
{litwareinc:ENTERPRISEPACK}

"Expanding" the Licenses property gives us a little more information:

ExtensionData     AccountSku       AccountSkuId ServiceStatus
-------------     ----------       ------------ -------------
System.Runtime... Microsoft.On...  litwarein... {Microsoft.Online.A...

And then by expanding the ServiceStatus property we can get back even more information:

*Service plan* *Description*
SWAY
Sway
TEAMS1
Microsoft Teams
YAMMER_ENTERPRISE
Yammer
RMS_S_ENTERPRISE
Azure Rights Management (RMS)
OFFICESUBSCRIPTION
Office Professional Plus
MCOSTANDARD
Skype for Business Online
SHAREPOINTWAC
Office Online
SHAREPOINTENTERPRISE
SharePoint Online
EXCHANGE_S_ENTERPRISE
Exchange Online Plan 2

Note

You say that's too much typing? Well, if you can put up with a little Windows PowerShell obtuseness, you can run this condensed version of the command instead: > (Get-MsolUser -UserPrincipalName BelindaN@litwareinc.com).Licenses[0].ServiceStatus

In case you're wondering, we can "expand" the Licenses property because Licenses is a multivalued property: it's a single property that can store multiple values. When we expand a property value we simply drill down to get at these additional values that, by default, are not displayed onscreen.

Note

So how are you supposed to know that a value is a multivalued property? Well, to find that out, try running a command similar to this: > Get-MsolUser -UserPrincipalName BelindaN@litwareinc.com | Get-Member> The Get-member cmdlet returns information about the object itself; in this case, information about the property values that make up a user account object. Here's what Get-Member has to say about the Licenses property:> Licenses Property System.Collections.Generic.List[Microsoft.On...> If the property definition says something about collections (in this case, System.Collections.Generic.List) then you know you're dealing with a multivalued property.

So what does all this mean? To answer that, let's first take another look at the information returned by the Get-MsolUser cmdlet:

ServicePlan                       ProvisioningStatus
-----------                       ------------------
SWAY                              Success
INTUNE_O365                       Success
YAMMER_ENTERPRISE                 PendingInput
RMS_S_ENTERPRISE                  Success
OFFICESUBSCRIPTION                Success
MCOSTANDARD                       Success
SHAREPOINTWAC                     Success
SHAREPOINTENTERPRISE              Success
EXCHANGE_S_ENTERPRISE             Success

And let's also take a look at a table that explains what these oddly-named service plans really represent:

*Service plan* *Description*
SWAY
Sway
TEAMS1
Microsoft Teams
YAMMER_ENTERPRISE
Yammer
RMS_S_ENTERPRISE
Azure Rights Management (RMS)
OFFICESUBSCRIPTION
Office Professional Plus
MCOSTANDARD
Skype for Business Online
SHAREPOINTWAC
Office Online
SHAREPOINTENTERPRISE
SharePoint Online
EXCHANGE_S_ENTERPRISE
Exchange Online Plan 2

Got all that? MCOSTANDARD is just an internal programming name for Skype for Business Online, while OFFICESUSBCRIPTION is just the internal programming name for Office Professional Plus. It's not the most intuitive thing in the world, but as long as you keep this table handy you won't have many problems when it comes to working with Office 365 services.

But wait: there's more. As we learned in the article View licenses and services with Office 365 PowerShell, if the ProvisioningStatus is set to Success that means that the service has been fully enabled; for example if MCOSTANDARD is set to Success that means that the user can access Skype for Business Online. If the ProvisioningStatus is set to PendingInput that means that Office 365 is still processing the service request; however, the user can typically log on and access the service while the request finishes processing. ( YAMMER_ENTERPRISE will always be shown as PendingInput, but that's OK: that won't stop a user from logging on to Yammer).

Important

Users can install and activate a new Office Professional Plus installation while OFFICESUBSCRIPTION is in the PendingInput state.

And, needless to say, is a service is set to Disabled that means that the service in question is not available to the user.

Find users that have access to specific Office 365 PowerShell services

In a separate article, we saw how you can use Office 365 PowerShell to disable user access to services. (If you missed that article, see Disable access to services with Office 365 PowerShell). That leads to an obvious question: is there any way to determine which users (that is, more than one user) have which services enabled or disabled?

We were hoping that someone would ask that. In order to answer that question, let's review the table of services that we first looked at in the article View licenses and services with Office 365 PowerShell for our only available licensing plan litwareinc:ENTERPRISEPACK:

*Service plan* *Description*
SWAY
Sway
TEAMS1
Microsoft Teams
YAMMER_ENTERPRISE
Yammer
RMS_S_ENTERPRISE
Azure Rights Management (RMS)
OFFICESUBSCRIPTION
Office Professional Plus
MCOSTANDARD
Skype for Business Online
SHAREPOINTWAC
Office Online
SHAREPOINTENTERPRISE
SharePoint Online
EXCHANGE_S_ENTERPRISE
Exchange Online Plan 2

As you might recall, the service plan is nothing more than the internal programming name for a product; for example, OFFICESUBSCRIPTION, to name one, is the internal programming name for Office Professional Plus. If OFFICESUBSCRIPTION shows up as SUCCESS on a user's service plan, then that means that the user is allowed to access Office Professional Plus. If EXCHANGE_S_ENTERPRISE is listed as DISABLED that means the user can't use Exchange Online.

Important

Users can install and activate a new Office Professional Plus installation while OFFICESUBSCRIPTION is in the PendingInput state.

Now is the time where the order in which the services appear is extremely important. Windows PowerShell assigns an index number to each entry in the list. The first entry is 0, the next entry is 1, and so on. The results are explained in the following table:

*Index number* *Service plan*
0
SWAY
1
INTUNE_O365
2
YAMMER_ENTERPRISE
3
RMS_S_ENTERPRISE
4
OFFICESUBSCRIPTION
5
MCOSTANDARD
6
SHAREPOINTWAC
7
SHAREPOINTENTERPRISE
8
EXCHANGE_S_ENTERPRISE

As you can see, SWAY is the first service listed, so it gets assigned index number 0.

Caution

Why 0 and not 1? That's a programming thing. In programming languages indices tell you how far an item is "offset" from the beginning of the array. The first item is the beginning of the array, so its offset is 0. The second item is 1 item from the beginning of the array, so its offset is 1.

Let's try an example. Suppose we'd like a list of all the licensed users who have not been enabled for Exchange Online. To do that, we can use the following command:

Get-MsolUser | Where-Object {$_.isLicensed -eq $true -and $_.Licenses[0].ServiceStatus[8].ProvisioningStatus -eq "Disabled"}

Admittedly, that's a cryptic-looking little command, so let's take a minute to explain how it works. This is actually a two-part command, and the first part is very simple: we use the Get-MsolUser cmdlet to return a collection of all our Office 365 users (both licensed and unlicensed):

Get-MsolUser

That information is then piped to the Where-Object cmdlet. Where-Object goes through all the user accounts and looks for those accounts that meet both of the following criteria:

  • The isLicensed property is equal to ( -eq) True ( $true). That enables us to weed out the unlicensed users.

  • The value of the Licenses[0].ServiceStatus[8].ProvisioningStatus property is equal to ( -eq) Disabled. For our immediate purposes, the important part of this unwieldy property name is this:

    ServiceStatus[8]

    The [8] represents the index number for Exchange Online. (We know that from looking at the table a few minutes ago). What if we wanted to find all the users enabled for Skype for Business Online? Well, the index number for Skype for Business Online is 5, so we'd use this syntax:

    ServiceStatus[5]

    Etc., etc.

    Incidentally, Licenses[0] indicates the licensing plan that we want to look at. Since our test domain only has one licensing plan this doesn't matter much. But suppose we had a user who has been assigned licenses from two different licensing plans. In that case, Licenses[0] would represent the first licensing plan, and Licenses[1] would represent the second licensing plan.

    To find the licenses that are assigned to a user, and the order in which they are listed, run the following command:

    Get-MsolUser -UserPrincipalName <Account>  | Format-List DisplayName,Licenses
    

Do you see how this all works? The index number for Office Professional Plus is 4; therefore, this command returns a list of all the users who have not been enabled for Office Professional Plus:

Get-MsolUser | Where-Object {$_.isLicensed -eq $true -and $_.Licenses.ServiceStatus[4].ProvisioningStatus -eq "Disabled"}

And what if we wanted a list of users who have been enabled for Office Professional Plus? Well, if you've been enabled then your ServiceStatus will either be PendingInput or Success; in other words, your ServiceStatus will not equal ( -ne) Disabled. That means all we have to do is take our previous command and swap out the -eq operator for the -ne operator:

Get-MsolUser | Where-Object {$_.isLicensed -eq $true -and $_.Licenses.ServiceStatus[4].ProvisioningStatus -ne "Disabled"}

As the saying goes, that code probably won't win many beauty contests. And, truth be told, the code can get even more tangled. For example, suppose we want to look for users who have been enabled for both Skype for Business Online and Exchange Online:

Get-MsolUser | Where-Object {$_.isLicensed -eq $true -and $_.Licenses.ServiceStatus[5].ProvisioningStatus -ne "Disabled" -and $_.Licenses.ServiceStatus[8].ProvisioningStatus -ne "Disabled"}

But don't worry too much about how gnarly that might look: the important thing is that, with relatively little effort, you can retrieve this information. Can't you get at this same information using the Office 365 admin center? In theory, yes but, in practical terms, no. To get at this same information using the Office 365 admin center you'd need to look at the licensing information for each user, one user at a time, and then manually keep track of who'd been enabled for X and who hadn't. That would work, but let's be honest: if you have more than 10 or 11 users, you're not going to do this. It's way too tedious and time-consuming.

Which, of course, is why we have Windows PowerShell: Windows PowerShell helps save you from tedious and time-consuming tasks such as that.

Here's an example of a command for viewing service information for a specified set of services as identified by their Licenses and ServiceStatus indexes for an Office 365 E5 subscription:

Get-MsolUser | Select-Object DisplayName, @{Name="Sway";Expression={$_.Licenses[0].ServiceStatus[12].ProvisioningStatus}}, @{Name="Teams";Expression={$_.Licenses[0].ServiceStatus[7].ProvisioningStatus}}, @{Name="Yammer";Expression={$_.Licenses[0].ServiceStatus[20].ProvisioningStatus}}, @{Name="AD RMS";Expression={$_.Licenses[0].ServiceStatus[19].ProvisioningStatus}}, @{Name="OfficePro";Expression={$_.Licenses[0].ServiceStatus[21].ProvisioningStatus}}, @{Name="Skype";Expression={$_.Licenses[0].ServiceStatus[22].ProvisioningStatus}}, @{Name="SharePoint";Expression={$_.Licenses[0].ServiceStatus[24].ProvisioningStatus}}, @{Name="Exchange";Expression={$_.Licenses[0].ServiceStatus[23].ProvisioningStatus}} | ConvertTo-CSV > "C:\Service Info.csv"

This command creates a CSV file showing all of your users and their service statuses for a specified set of services (Teams, Yammer, AD RMS, OfficePro, Skype, SharePoint, and Exchange).

Note

You can get the list of services in a subscription from the (Get-MsolUser -UserPrincipalName <user account UPN>).Licenses[<LicenseIndexNumber>].ServiceStatus command. In the output, you start numbering the service indexes with 0. The preceding command is just an example. Index numbers for services can change over time.

See also

See the following additional topics about managing users with Office 365 PowerShell:

For more information about the cmdlets that are used in these procedures, see the following topics:

New to Office 365?

Tip

LinkedIn logo New to Office 365?

Discover free video courses for Office 365 admins and IT pros, brought to you by LinkedIn Learning.