Export Office 365 User License Report With PowerShell

As an Office 365 Administrator, often you are in the situation to get all licensed users with their assigned licenses and services. Using the O365 admin portal, you can get user’s license information, but you need to click each user to know about their license subscriptions and service status which is a cumbersome task. To ease your work, you can use PowerShell commands. Get-Msoluser will get the details of all Office 365 users and Where condition used to filter out licensed users alone. Now, you can export O365 licensed users to CSV file.

Do you think it’s easy? Definitely not! Because we need to consider following things before jumping right away.

  1. A user can have multiple licenses.
  2. Each license gives access to a set of services.
  3. A user might not have access to all services. Some services might be enabled or disabled based on user needs.
  4. License subscription names are not user-friendly by default.

We have created a PowerShell script that will get you the detailed license usage report covering all the above cases. It reports all licensed users with their country, assigned licenses, services, and its status. So! Let’s jump into the script right away.

Download Script: O365UserLicenseReport

Script Highlights:

  • Exports Office 365 user license report to CSV file.
  • You can choose to either “export license report for all office 365 users” or pass an input file to get license report of specific users alone.
  • License Name is shown with its friendly name  like ‘Office 365 Enterprise E3’ rather than ‘ENTERPRISEPACK’.
  • The script can be executed with MFA enabled account
  • The script gives 2 output files. One with the detailed report of O365 Licensed users another with the simple details.
  • Output file stores most required attributes like Display Name, User Principal Name, Country, Licenses, License Friendly Name, Service, Service Friendly Name, and Service Status. You can include more attributes by easily modifying the script.


Office 365 License Report – Sample Outputs:

Exported report shows list of licensed users and their assigned licenses.

Detailed Office 365 User License Report:

Office 365 User License report

Detailed Office 365 users’ assigned license report contains user’s Display Name, User Principal Name, License Plan, Friendly-name of License Plan, Service Name, Friendly-name of Service, and Service Status.


Simple Office 365 User License Report:

Office 365 user License report to csv

The simple Office 365 user license report contains user’s Display Name, User Principal Name, and Friendly-name of assigned license with their respective services.


Office 365 User License Report – Execution Methods:

You can use this script to either export all licensed users or export list of licensed users in Office 365.

Export all Licensed Users in Office 365:

To export all licensed users in Office 365, run the script as follows.


Get Office 365 License Report for a Single/List of Office 365 Users:

You can use –UserNamesFile param to get license report of a user from the input list called “UserNamesInput.txt”.

The UserNamesFile must follow the format below: UPN separated by new line without header.

Office 365 User License report PowerShell

Note: As an admin, it’s essential to know when your subscriptions are going to expire or when Microsoft will charge for renewal. If you are not sure about the answer, you can check Office 365 subscription expiry date report.

Get More Detailed Office 365 License Report:

If you want to get more detailed Office 365 license reports based on

  • Regainable licenses
  • Users and Licenses
    • Licensed users
    • Unlicensed users
    • Users with specific subscription
    • Users with free subscription
    • Users with trial subscription
    • User license changes
  • License expiry
    • Purchased subscription expiring users
    • Purchased subscription expired users
    • Trial expiring users
    • Trial expired users
    • Users with suspended subscription
  • Subscription
    • Subscription usage report
    • Expired subscription
    • Unused subscription
    • Purchased subscription
    • Trial subscription

you can take a look at AdminDroid Microsoft 365 reporting and auditing tool.

AdminDroid provides over 100+ reports and a handful of dashboards completely for free. It includes reports on Users, Licenses, Groups, Group Members, Devices, Login Activities, Password Changes, License Changes, and more. The free edition doesn’t have any restrictions in reporting functionalities such as customization, scheduling, and exporting. For your Azure AD reporting and auditing needs, you can download Free Office 365 reporting tool by AdminDroid and see how it helps for you.

Office 365 license usage reportazure-overall-dashboardOffice 365 reporting tool technetPowerShell free Office 365 Reporting Tool

Additionally, AdminDroid provides 1500+ pre-built reports and 20 smart visually appealing dashboards to know about your Office 365 environment at a glance. This tool provides reports on Office 365 reporting, auditing, analytics, usage statistics, security & compliance, etc.

I hope export Office 365 license report using PowerShell blog was helpful. If you modify the script and use it for other use cases, then please leave your idea in the comment section and help more admins.