Get domain users who has an exchange license assigned

How can i get all domain users with ms365 exchange license assigned with powershell?
eg. there are the users George and Nick in Active Directory, George has the MS365_Business_Premium license and Nick has the Exchange_Online_Plan1 license.

i want with a PS command to export the results on a csv like below, MS365_Business_Premium, Exchange_Online_Plan1 license

Hey George!

Welcome :slight_smile: . I suggest taking a look at Microsoft Graph and the ‘assignedplans’ property of Get-MgUser. Ironically someone else mentioned doing some similar (but different work) and I shared a medium article that had a nifty command in it: Translate Microsoft 365 License GUIDs to Product Names in PowerShell | by Martin Heusser | M365 Apps & Services MVP | Medium

$translationTable = Invoke-RestMethod -Method Get -Uri "" | ConvertFrom-Csv

That translation table can translate the assignedplans SKU of a service plan to what the ‘friendly name’ is. For example , Exchange Online (Plan 1) ‘plan’ has a service ID of ‘9aaf7827-d63c-4b61-89c3-182f06f82e5c’

So as a quick example, If I’m looking at my own assigned plans:

$test = Get-MgUser -UserId $UPN -Select id, displayName, assignedLicenses, assignedPlans

$test.assignedplans has all of my assigned plans. I’d probably filter out everything but the ‘enabled’ ones using PowerShell, then you can do translation using the translation table I mentioned, so you can display the ‘friendly name’ in your process.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.