O365 – Export Licensed Users

While reviewing user account licensing status in my Office 365 tenant, I noticed that there is no Export button when the list is filtered by Licensed Users.  I’m not sure why there would not be a button for exporting the list as filtered because there is an Export button when you filter by Unlicensed Users (see screenshots below).

Active users list filtered by License Users — no Export button!  (Click to enlarge.)Licensed Users FilterActive users list filtered by Unlicensed Users — Export button.  (Click to enlarge.)Unlicensed Users Filter

The fix is to export a list using PowerShell!

Export a List of Licensed Users

Open PowerShell and connect to Office 365/MSOL (see instructions here if you have not done this part before).

Type the following code into PowerShell, changing the output file name and location as needed.

$users = Get-MsolUser -All | Where-Object {$_.IsLicensed -eq "TRUE"}
$users | Export-Csv -Path C:\Scripts\O365\LicensedUsers.csv

That’s all there is to it.  Now you have a list of Office 365 Licensed Users in .csv format.