A robust email, calendaring, and collaboration platform developed by Microsoft, designed for enterprise-level communication and data management.Miscellaneous topics that do not fit into specific categories.
This reference is relevant and helpful for understanding how to export nested distribution group members using PowerShell: Export Office 365 Nested Distribution Group Members Using PowerShell.
This information is provided as a convenience. The site is not controlled by Microsoft, and Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please ensure that you fully understand the risks before using any suggestions from the above link.
It demonstrates a recursive approach to expanding nested distribution groups and generating a detailed membership report. This is necessary because the native Get-DistributionGroupMember cmdlet only returns direct members by default.
However, there are important limitations to consider. The script is designed for Exchange Online only and it does not fully support hybrid environments where distribution groups exist across both Exchange Online and on‑premises Exchange.
In a hybrid environment, directory-synchronized (on-premises) groups must be queried from on-premises Exchange. Cloud-only groups must be queried from Exchange Online
While the recursive logic used in the script is valid and reusable, it cannot be applied directly without modification. The main differences are:
- Exchange Online uses
Connect-ExchangeOnline - On-premises Exchange requires Exchange Management Shell or remote PowerShell session.
For a complete solution in hybrid, the approach should be:
- Detect whether each group is cloud-only or directory-synchronized
- Query the group from the correct environment
- Apply recursive expansion logic across both environments
- Consolidate results into a unified report
I hope this information is helpful.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.