Exporting the group members as a CSV file

Anonymous
2019-10-10T17:02:47+00:00

I need to export members from distribution groups to csv file. I saw a post from 2017 on how to accomplish this request, but it seems it doesn't work for me when I tried it.

When I tried the more export data to a csv file, I get all the group names instead of the members of the group I have selected.

Can you please help me.

This is the link that I was following,

https://answers.microsoft.com/en-us/msoffice/forum/all/exporting-distribution-groups-from-office-365/e7955e69-6438-445f-93ec-f23b06c7b003

Thank you,

Microsoft 365 and Office | Subscription, account, billing | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Anonymous
    2019-10-10T20:35:11+00:00

    Hi Ernesto Lopez,

    Thank you for the posting in our forum community.

    Regarding your description, for exporting distribution group member CSV file, kindly try this below PowerShell cmdlet, if it can work for you.

    Note: Run PowerShell cmdlet as an administrator. Only Office 365 global admin can run PowerShell cmdlet.

    1. First, there is need to Connect to Exchange Online PowerShell

    • $UserCredential = Get-Credential

    • $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic –AllowRedirection

    • Import-PSSession $Session –DisableNameChecking

    2. Run this below PowerShell script with your distribution group name.

    The following Powershell script gets members of a given distribution group and exports output to CSV file. Replace the distribution group name "DL" with your own group name in the below script.

    $DGName = "DL"

    Get-DistributionGroupMember -Identity $DGName | Select Name, PrimarySMTPAddress |

    Export-CSV "C:\Distribution-List-Members.csv" -NoTypeInformation -Encoding UTF8

    Here is the screenshot for your reference:

    After running above PowerShell cmdlet, we can see that .CSV file on C: drive:

    If you have more than one distribution groups, kindly update the .CSV file name in PowerShell cmdlet.

    For example:

    If the other distribution group name is “DL1”, kindly change the highlighted part in the below PowerShell cmdlet.

    $DGName = "DL1"

    Get-DistributionGroupMember -Identity $DGName | Select Name, PrimarySMTPAddress |

    Export-CSV "C:\Distribution-List-Members1.csv" -NoTypeInformation -Encoding UTF8

    Hopefully above information will work for you.

    Regards,

    Darpan

    10 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2019-10-11T21:25:55+00:00

    Hi Ernesto Lopez,

    If you need any other information or help, please feel free to contact us.

    Regards,

    Darpan

    0 comments No comments