Export Office 365 Dynamic Distribution Group Members to CSV using PowerShell

Exports Office 365 Dynamic Distribution Groups members to CSV using PowerShell. The exported report will include Display Name, Primary SMTP Address, Alias, Manager(ManagedBy), Group Members Count, Member Type, Count By Members Type.

5 Star
1,655 times
Add to favorites
Office 365
E-mail Twitter del.icio.us Digg Facebook
  • stored cred
    1 Posts | Last post January 11, 2020
    • Is there a way to run this script with a stored username and password? 
      read-host -AsSecureString | ConvertFrom-SecureString | Out-File $LocalFilePath\cred_$env:PassEncrypted.txt
      $TenantUname = “user@dom.com”
      $TenantPass = cat “PassEncrypted.txt” | ConvertTo-SecureString
      .\GetDistributionGroupMembers.ps1 -UserName $TenantUname -Password $TenantPass
      Doesn't seem to be working. Want to use as part of an automated export. creds work for connecting separately
  • MFA
    2 Posts | Last post July 12, 2019
    • I can't get the -MFA to work.  It says: A parameter cannot be found that matches parameter name 'mfa'.
    • Hi,
      The script has been updated. You can download the updated script to work with MFA.
  • Exchange 2016 on-pre
    3 Posts | Last post April 04, 2019
    • does this script work for Exchange 2016 on-premise?  Also if a group has nested groups does the member only count immediate group members or include nested group members?
    • Hi Chris,
      This script works for Exchange Online, and it lists immediate group members alone. If you need a script to include nested group members in Exchange online, let us know.
    • Yes, please.  I need a script to list all members including nested group members with all type of users. But at the moment I'm in need a script for Exchange on premise.  Is there one as you know?