How to export all users of dynamic distribution list in Microsoft 365

How to export all users of dynamic distribution list in Microsoft 365

Dynamic Distribution Lists (DDL) in Microsoft 365 are groups that automatically include users based on filters and conditions. However, you cannot directly export members of a DDL as you would with a regular distribution list. Instead, you can use PowerShell to achieve this by first connecting to Exchange Online and then executing a script to retrieve and export the members based on the filter rules.

Here's a step-by-step guide to exporting all users of a Dynamic Distribution List in Microsoft 365:

1. Install the Exchange Online Management module for PowerShell if you haven't already:
Install-Module -Name ExchangeOnlineManagement
2. Connect to Exchange Online:
Connect-ExchangeOnline

Enter your Microsoft 365 admin credentials when prompted.

3. Find the DDL using its name or email address:

Replace <DDL_Name_or_Email> with the name or email address of the DDL you want to export:

$DDL = Get-DynamicDistributionGroup -Identity "<DDL_Name_or_Email>"
4. Retrieve the recipients (users) based on the DDL filter:
$Members = Get-Recipient -RecipientPreviewFilter $DDL.RecipientFilter -ResultSize Unlimited
5. Export the members to a CSV file:

Replace <Export_Path> with the path where you want to save the CSV file:

$Members | Select-Object DisplayName, PrimarySmtpAddress | Export-Csv -Path "<Export_Path>" -NoTypeInformation

This will create a CSV file containing the display name and primary email address of all the users included in the DDL.

6. Disconnect from Exchange Online:
Disconnect-ExchangeOnline -Confirm:$false

That's it! You should now have a CSV file containing all the users of the Dynamic Distribution List in Microsoft 365.


    • Related Articles

    • Adding a New Multi-Factor Authentication (MFA) Method for Microsoft 365

      Multi-Factor Authentication (MFA) is a crucial security feature that adds an extra layer of protection to your Microsoft 365 account. By requiring more than one method of authentication, MFA helps to ensure that your data and account are secure even ...
    • Azure and Microsoft 365 Services Disclaimer

      Services provided by IT Partner are designed to help our customers use Microsoft Azure and Microsoft 365 Cloud platforms. While we strive to provide the highest level of service and support, please be aware of the following: 1. Service Availability: ...
    • Recommended steps to take if an account is compromised

      Recommended steps to take if an account is compromised: Reset the user's password immediately. Do not communicate the new password through email to the end user. Enable Multi-Factor Authentication (MFA) to prevent compromised accounts, especially for ...
    • Migrating your MFA (Multi-Factor Authentication) and SSPR (Self-Service Password Reset)

      Migrating your MFA (Multi-Factor Authentication) and SSPR (Self-Service Password Reset) policy settings to the Authentication methods policy in Microsoft Entra ID is a crucial step to streamline and enhance your security management. Here's a detailed ...
    • How to create a new Outlook Profile

      Exit Outlook. In Control Panel, click or double-click Mail. Where is Mail in Control Panel? Mail appears in different Control Panel locations depending on the version of the Microsoft Windows operating system, Control Panel view selected, and whether ...