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.
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.
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 } }
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.
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.