Get-DistributionGroupMember

Roger Roger 6,406 Reputation points
2023-06-19T05:10:40.1666667+00:00

Hi All

i have mail enabled security group in exchange online. i want to export the mail enabled security group members to csv file. will the below syntax work.

Get-DistributionGroupMember -Resultsize Unlimited mailenabledsecuritygroup@contoso.com | Select DisplayName,title,userprincipalname,PrimarySMTPAddress,RecipientType |  Export-csv -path C:\temp\output.csv -NoTypeInformation

Microsoft Exchange Online
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,594 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,682 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,140 questions
{count} votes

Accepted answer
  1. Yuki Sun-MSFT 41,146 Reputation points Microsoft Vendor
    2023-06-20T03:10:06.3933333+00:00

    Hi @Roger Roger ,

    UserPrincipalName will be empty in the command you shared above. Based on my test, you can use the command below so that all properties listed can be included:

    Get-DistributionGroupMember -Resultsize Unlimited mailenabledsecuritygroup@contoso.com | %{Get-Mailbox $_.Name | select DisplayName,userprincipalname,@{Expression={(Get-User $_.Name).title};Label="title";},PrimarySMTPAddress,RecipientType} |  Export-csv -path C:\temp\output.csv -NoTypeInformation
    
    

    User's image



    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Vasil Michev 108.4K Reputation points MVP
    2023-06-19T15:50:27.1233333+00:00

    it will work, however not all selected properties will be exposed, as the output of the cmdlet returns a ReducedRecipient object. For example, Title and UserPrincipalName will be empty. If you need to include these properties, you will have to make additional calls to the Get-User cmdlet or similar.

    0 comments No comments

  2. 2024-10-28T16:02:48.3066667+00:00

    Is it possible to display Cyrillic DisplayName?
    Now

    "DisplayName","Title","userprincipalname","PrimarySmtpAddress","RecipientType"

    "????? ?????? ????????","abit24",,"****@**.dp.ua","UserMailbox"

    0 comments No comments

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.