This script demonstrates how to use Exchange Web Service Managed API to get group members in distribution groups. Additionally, this script enables you to easily get group members if you have nested distribution groups.
Get distribution group members in Office 365 Exchange Online is a common maintenance job for Office 365 administrators. They need this information for varieties of reasons. For example, they want to compare two different email formats of distribution group members before applying new email formats.
You can find more All-In-One Script Framework script samples at https://aka.ms/onescriptingallery