We can use the Azure AD powershell cmdlet Get-MsolUser to get all office 365 users. This command also returns the license based property IsLicensed and Licenses (applied license details).
Note: Before proceed, Install and Configure Azure AD PowerShell
Run the below command to get all the office 365 users.
Get-MsolUser -All | Select-Object UserPrincipalName, DisplayName, isLicensed
The below command returns only licensed office 365 users.
Get-MsolUser -All | Where-Object { $_.isLicensed -eq $true } | Select-Object UserPrincipalName, DisplayName, Department
You can also extract what are the licenses has been assigned to every users.
Get-MSOLUser -All | Where-Object { $_.isLicensed -eq $true } | Select-Object UserPrincipalName, DisplayName, {$_.Licenses.AccountSkuId}
Run the below command to export all the licensed users and applied license details to csv file.
Get-MSOLUser -All | Where-Object { $_.isLicensed -eq $true } | Select-Object UserPrincipalName, DisplayName, {$_.Licenses.AccountSkuId} | Export-CSV "C:\office-365-users-license.csv" -NoTypeInformation -Encoding UTF8
You can read this technet article: https://technet.microsoft.com/en-us/library/dn771771.aspx to get fine-tuned license report, like all licensed users who are enabled for specific license plan.
Advertisement