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