This post is a part in a series of blog post which explains how to reproduce the filters which are provided by the O365 admin portal. We just learn how to filter like the O365 portal – with PowerShell scripting … This time I show you how to find licensed users in your tenant
Getting a list of licensed O365 users with PowerShell
This is the filter we want to reproduce:
To get a list of all licensed user accounts in your O365 / Azure AD tenant by script, use this PowerShell command. There is no server-side filter available for this, so we have to load the entire list of user accounts… could be quite slowly.
Get-AzureADUser -All $true | Where {$_.AssignedLicenses.Count -ne 0}
You could also use the old MSOL module:
Get-MsolUser -All | Where {$_.isLicensed -eq $true}