Check Distribution Lists for a Specific Email Address Using PowerShell

By Mark D. Albin, MS

How to Check Distribution Lists for a Specific Email Address Using PowerShell in Exchange Online

In Exchange Online, it’s important for administrators to check which distribution lists a specific email address belongs to. This can be easily done using PowerShell. Follow these steps to get a list of distribution groups that a specific user is a member of.

Prerequisites

  • Admin access to Microsoft 365 or Exchange Online
  • PowerShell installed on your computer
  • Exchange Online Management Module installed

Step-by-Step Instructions

Step 1: Connect to Exchange Online

Before you can run commands, you need to connect to Exchange Online using PowerShell.


$UserCredential = Get-Credential Connect-ExchangeOnline -UserPrincipalName <your_admin_email> -Credential 
$UserCredential 

                     

This command will prompt you to enter your admin credentials for Microsoft 365.

Step 2: Run the PowerShell Script

Use the following PowerShell script to check all distribution lists for the email address you want to verify. Replace EMAIL ADDRESS TO SEARCH FOR with the email address you're checking.


$User = "EMAIL ADDRESS TO SEARCH FOR" 
$groups = Get-DistributionGroup -ResultSize Unlimited foreach ($group in $groups) { if (Get-DistributionGroupMember -Identity $group.Identity | Where-Object {$_.PrimarySMTPAddress -eq $User}) { Write-Output $group.Name } }  

Step 3: Review the Output

The output will display the names of the distribution groups that the specified user is a member of. You can use this list to manage distribution groups or troubleshoot issues related to email distribution.

Conclusion

Using PowerShell is an efficient way to check all distribution lists for a specific email address in Exchange Online. By following the above steps, you can quickly identify which groups a user belongs to and manage memberships accordingly.

Check Distribution Lists for a Specific Email Address Using PowerShell