How to get dynamic distribution groups in Exchange Online and export the list
This article explains the procedure to use PowerShell to list all dynamic distribution groups in Exchange Online or Office 365, and also export them. It also compares it with ADManager Plus, a unified Active Directory, Office 365 and Exchange management and reporting tool, to show how ADManager Plus helps get dynamic distribution groups list and export it easily.
Steps to use PowerShell to get dynamic distribution groups list.
- Ensure you have the necessary permissions to report on distribution groups.
- Create the script using the Get-DynamicDistributionGroup cmdlet, and execute it in the PowerShell window.
A sample script to get Exchange Online dynamic distribution groups using PowerShell
Click to copy entire script
Get-DynamicDistributionGroup | Export -CSV "D:DGList.csv"
To get dynamic distribution groups report
- Launch Dynamic Distribution Groups report from Group Reports under Office 365 tab.
- Select the desired Office 365 tenant, and click Generate. Choose CSV from Export as option.
» Start 30-day Free Trial
The PowerShell script mentioned above will fetch the list of all dynamic distribution groups in an Office 365 tenant and export the distribution group list to CSV
Limitations of using PowerShell to get dynamic distribution groups in Office 365 or Exchange Online.
- You will not be able to generate this report using PowerShell if you do not have sufficient permissions and Exchange PowerShell. With ADManager Plus, users’ privileges in native Active Directory or Exchange doesn't have to be elevated, and they can be allowed to do this operation only in specific OUs or domains.
- To export this report to any other format instead of CSV, you will have to modify the script. With ADManager Plus though, it is offered as a built-in option that's available by default.
- You must know how to execute the scripts from the PowerShell window or command line. ADManager Plus is purely GUI-based, allowing you to perform all management and reporting actions with just mouse clicks from its web-based console.
- Even a misplaced hyphen, a typo in the LDAP names or lack of sufficient permission to configure any of the attributes used in the script will lead to errors. As all actions in ADManager Plus are GUI-driven, there is no need to write scripts, eliminating the chances of errors.