Export all members of a distribution list in Exchange Online & Office 365

These days there are lots of companies migrating to or adopting Office 365 and using exchange online as their email service.

With the availability of Distribution List & Groups in Exchange Online the users are creating them or adding the users in bulk or manually (as required). Later on when there is a need to export the list of members from a certain distribution list or group, unfortunately there is no straight option available right on the portal for which user has to opt for other options and procedures.

Today we will see how we can export the list of members from distribution list.

  1. Open Windows PowerShell.
  2. Connect to Exchange Online using the below code and login using administrator account when prompt for ID & Password:
$O365Cred = Get-Credential

$O365Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $O365Cred -Authentication Basic -AllowRedirection

Import-PSSession $O365Session

3. Run the following command and provide the Distribution List/Group name for -Identity attribute. Mention the destination location for Export-csv attribute to save the extracted .csv file.

Get-DistributionGroupMember -Identity "Group Name" | Select Name, PrimarySmtpAddress | Export-csv C:\Users\myuser\Desktop\members.csv -NoTypeInformation

4. A .csv file will be saved on desktop or on the mentioned location.

blog

Leave a comment