# Get domain users who has an exchange license assigned

**URL:** <https://forums.powershell.org/t/get-domain-users-who-has-an-exchange-license-assigned/23459>\
**Category:** PowerShell Help\
**Created:** [January 23, 2024, 7:57am UTC](https://forums.powershell.org/t/get-domain-users-who-has-an-exchange-license-assigned/23459 "2024-01-23T07:57:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![georgesaxi](https://avatars.discourse-cdn.com/v4/letter/g/a698b9/32.png) [@georgesaxi](https://forums.powershell.org/u/georgesaxi)\
**Post date:** [January 23, 2024, 7:57am UTC](https://forums.powershell.org/t/get-domain-users-who-has-an-exchange-license-assigned/23459/1 "2024-01-23T07:57:43Z")

</div>

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  
[george@test.com](mailto:george@test.com), MS365\_Business\_Premium  
[Nick@test.com](mailto:Nick@test.com), Exchange\_Online\_Plan1 license

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [January 23, 2024, 9:51pm UTC](https://forums.powershell.org/t/get-domain-users-who-has-an-exchange-license-assigned/23459/2 "2024-01-23T21:51:31Z")

</div>

Hey George!

Welcome 🙂 . 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](https://medium.com/@mozzeph/translate-microsoft-365-license-guids-to-product-names-in-powershell-e8fa373ace16)

```powershell
$translationTable = Invoke-RestMethod -Method Get -Uri "https://download.microsoft.com/download/e/3/e/e3e9faf2-f28b-490a-9ada-c6089a1fc5b0/Product%20names%20and%20service%20plan%20identifiers%20for%20licensing.csv" | 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:

```powershell
$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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [February 22, 2024, 9:52pm UTC](https://forums.powershell.org/t/get-domain-users-who-has-an-exchange-license-assigned/23459/3 "2024-02-22T21:52:21Z")

</div>

Closed on February 22, 2024, 9:52pm UTC

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