Get-DistributionGroupMember

Rising Flight 4,596 Reputation points
2024-09-01T13:23:34.4+00:00

Hi All,

I am using an Exchange 2016 hybrid environment. We create users on-premises and then migrate them online. I have distribution lists both in Exchange on-premises and online. I want to export the user list from an on-premises distribution list. I am using the syntax below, but I am not getting output for all the attributes:

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

Is it possible to export onprem DLs user list from online. My requirement either it be onprem or online DL, i want to export DL members with the below information. I have this information both in onprem and online but i am unable to export.(the below attributes are synced to AzureAD as well). please guide me.

(DisplayName,JobTitle,userprincipalname,PrimarySMTPAddress,RecipientType,Department,Manager,EmployeeID,Office,Country,EmployeeType).

Microsoft Exchange Online
Exchange Server
Exchange Server
A family of Microsoft client/server messaging and collaboration software.
1,308 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,542 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,640 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,112 questions
{count} votes

Accepted answer
  1. Bruce Jing-MSFT 5,255 Reputation points Microsoft Vendor
    2024-09-02T07:42:12.67+00:00

    Hi,@Rising Flight

    Thanks for posting your question in the Microsoft Q&A forum.

    According to your description, you want the newsletter group list to export the user list and get the output of all the attributes.

    You don't get all the parameters of a member when you use Get-Distribution. Some parameters require the Get-maibox and Get-User commands to get them.

     

    Here is my solution:

    1. Enter the following command in Exchange Online PowerShell:
    Get-DistributionGroupMember -Identity "YourDLName" | Get-Mailbox | Select-Object DisplayName, UserPrincipalName, PrimarySmtpAddress, RecipientType, @{Name='Title';Expression={(Get-User $_.UserPrincipalName).Title}}, @{Name='Department';Expression={(Get-User $_.UserPrincipalName).Department}}, @{Name='Manager';Expression={(Get-User $_.UserPrincipalName).Manager}}, @{Name='EmployeeID';Expression={(Get-User $_.UserPrincipalName).EmployeeID}}, @{Name='Office';Expression={(Get-User $_.UserPrincipalName).Office}}, @{Name='CountryOrRegion';Expression={(Get-User $_.UserPrincipalName).CountryOrRegion}}, @{Name='EmployeeType';Expression={(Get-User $_.UserPrincipalName).EmployeeType}}
    | Export-Csv -Path "C:\DLmembers.csv" -NoTypeInformation
    
    

    User's image

    1. There were no errors, then go to the C drive and find the exported file.

    User's image

    1. Open the file.

    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 comments No comments

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.