In some situations we have to Export all the Distribution group and all the members of it to a CSV file. There is no command let available to retrieve the distribution group and distribution group members in bulk. Pipe line won’t work in this case.
**** Export all the Distribution group and Distribution Group managers as well***
***Export all the Dynamic Distribution group and Dynamic Distribution Group managers as well***
Primary SMTP address
Distribution Group Primary SMTP address
Distribution Group Managers
Distribution Group OU
I have wrote a script which will make Exchange Administrators life Easy to export distribution group and its members.
.Requires -version 2 – Runs in Exchange Management Shell
.\DistributionGroupMemberReport.ps1 – It Can Display all the Distribution Group and its members on a List
Or It can Export to a CSV file
Browse the Shell to the Appropriate Location
Run it as above
Output of CSV file look like Below
You can add some more entries if required
How to use this Script for Office 365 –
Local desktop . PowerShell – Run as Administrator
Make Sure your Execution Policy is set to RemoteSigned or Unrestricted
my Case its unrestricted.
To Get Execution Policy Status
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Now Run the Script – It should work.