Monthly Archives: December 2017

Export List of Office 365 Licenses by Type

It’s possible to to use Powershell to export lists of users who are allocated different licences in Office 365. This guide will help you export a csv file that contains a list of the users who have a specific license type.

Part 1 – Connecting to Office 365 with Powershell

  1. First open a powershell console enter the following:
    $UserCredential = Get-Credential
  2. You will be prompted for your Office 365 username and password
  3. Now we must establish a conenction using the stored credentials:
    Connect-MsolService -Credential $UserCredential
  4. Now that you are connected to Office 365’s powershell interface you can now issue commands to Office 365.

Part 2 – Listing Licences in your account

Enter the command:

Get-MsolAccountSku

This will display a list of licences and the number of each you own and are utilised.

AccountSkuiD: <instancename>:<licencename>
ActiveUnits: The number of licences available based on your subscription
WarningUnits: Licenses in warning state
ComsumedUnits: Licenses in use and assigned to users.

Part 3 – Exporting the Data for a specific Licenes Type

Enter the following command, this will export a list of users with Power BI Standard license assigned to them. Remember to change <instancename> to match the instance name displayed in your output from part 2.

get-MSOLUser -All | where {$_.isLicensed -eq "TRUE" -and $_.Licenses.AccountSKUID -eq "<instancename>:POWER_BI_STANDARD"} | select displayname,userprincipalname,isLicensed | export-CSV c:\crmstandardusers.csv

You will now have a CSV file containing a list of the users with the specified license. You can perform this with any licenses listed from the Get-MsolAccountSku command.