How to get distribution groups in Exchange Online and export the list

This article explains how to use PowerShell to get distribution groups list from Exchange Online or Office 365, and export the list. It also compares it with ADManager Plus, a unified Active Directory, Office 365 and Exchange management and reporting tool, to show how the latter helps get the list of distribution groups easily.

Windows PowerShell

Steps to use PowerShell to get distribution groups list.

  • Ensure you have the necessary permissions to perform this action and execute PowerShell scripts.
  • Create the script using the Get-DistributionGroup cmdlet, and execute it in the PowerShell window.

A sample PowerShell script to get distribution group list

Get-DistributionGroup | Export -CSV "D:\DGList.csv"
Click to copy entire script

ADManager Plus

To get distribution groups report

  • Launch the Distribution Groups report from Group Reports under Office 365 tab.
  • Select the desired Office 365 tenant, and click Generate Now. Choose CSV from Export as option.


Distribution Groups Report in ADManager Plus

» Start 30-day Free Trial

The PowerShell script mentioned above will list all distribution groups in Office 365 tenant and export the distribution group list to CSV

Limitations of using PowerShell to get 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 AD or Exchange doesn't have to be elevated, and they can be allowed to do this operation only in specific OUs or domains.
  • To get information about any specific group, to get the report in specific file format, or to format the output as a list or table, the script must be either modified or created from scratch with more parameters. ADManager Plus' purpose built features have all these options rolled into them, by default.
  • 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 trigger the scripts from the PowerShell window. 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.
  • Embark on your script-free AD management, reporting, and automation journey with ADManager Plus.
  • By clicking 'Start your free trial now', you agree to processing of personal data according to the Privacy Policy.
  • Thanks
  • Your download should begin automatically in 15 seconds. If not, click here to download manually.

Related Powershell How-to Guides:

The one-stop solution toActive Directory Management and Reporting

Email Download Link