DistributionGroupMember

Glenn Maxwell 11,496 Reputation points
2024-09-11T09:42:18.71+00:00

Hi All,

I am using an Exchange 2016 hybrid environment with distribution lists (DLs) both on-premises and online. I want to check if user1@contoso.com is a member of any DL (either on-premises or online). Will the syntax below fetch the required information? I need the output to include both the email address and display name. Please guide me.

Get-DistributionGroupMember onpremDL1@contoso.com -ResultSize Unlimited | ? {$_.PrimarySmtpAddress -eq 'user1@contoso.com'}

Get-DistributionGroupMember onlineDL1@contoso.com -ResultSize Unlimited | ? {$_.PrimarySmtpAddress -eq 'user1@contoso.com'}


Microsoft Exchange Online
Exchange Server
Exchange Server
A family of Microsoft client/server messaging and collaboration software.
1,337 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,578 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,669 questions
Microsoft Exchange Hybrid Management
Microsoft Exchange Hybrid Management
Microsoft Exchange: Microsoft messaging and collaboration software.Hybrid Management: Organizing, handling, directing or controlling hybrid deployments.
2,136 questions
{count} votes

Accepted answer
  1. Bruce Jing-MSFT 5,795 Reputation points Microsoft Vendor
    2024-09-12T06:53:16.4166667+00:00

    Hi,@Glenn Maxwell

    We can use PowerShell to check if user1@contoso.com is a member of any DL (local or online).

    The command you provided checks whether user1@contoso.com is a member of the onpremDL1@contoso.com group.

    You can run the following command to retrieve all DLs that contain user1@contoso.com.

     Get-DistributionGroup | where { (Get-DistributionGroupMember $_.Name | foreach {$_.PrimarySmtpAddress}) -contains "user1@contoso.com" }
    
    

    Here are the results of my tests:User's image

    If my answer is helpful to you, please mark it as the answer so that other users can refer to it. Thank you for your support and understanding.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.