How to export a list of Office 365 users to CSV

It’s quite easy to export a list of your Office 365 users to a CSV file, though you’ll need to open up PowerShell to do it.

This cmdlet will export a list of your licensed Office 365 users to a format that you can open in Excel.

How to prepare your computer to connect to Office 365

If you’ve never connected to Office 365 via PowerShell before, you might need to install the Microsoft Online Services Sign-In Assistant for IT Professionals RTW, and also the Azure Active Directory Module for Windows PowerShell.

Once these two components are installed, you can connect to Office 365 via PowerShell.

How to export a list of licensed Office 365 users to a CSV file

Go to Start, search for PowerShell and open Windows Powershell

  1. Run:
  2. Sign in with the username and password of an Office 365 Administrator.
  3. Then Run:
    Get-MSOLUser | Where-Object { $_.isLicensed -eq "True"} | Select-Object DisplayName, UserPrincipalName, isLicensed | Export-Csv C:\Temp\LicensedUsers.csv

You might decide to replace C:\Temp\LicensedUsers.csv with another location and filename.

Once the command has completed, you’ll have a list of your Office 365 Users in a CSV format at the specified location – eg.  C:\Temp\LicensedUsers.csv

Was this article helpful?

Related Articles

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *