How to create a new dynamic distribution groups in Exchange Online
This article explains the procedure to create dynamic distribution group in Exchange Online or Office 365 using PowerShell and ADManager Plus, a unified Active Directory, Office 365 and Exchange management and reporting tool, to demonstrate why the latter is the simpler and easier of the two.
Steps to use PowerShell to create a new dynamic distribution group.
- Ensure you have the necessary permissions to create distribution groups.
- Get the values for all necessary attributes viz., Name, Alias, RecipientFilter etc.
- Check if you have permission to configure all the attributes
- Create the script with these values, and execute it in the PowerShell window.
A sample script to create an Exchange Online dynamic distribution group using PowerShell
Click to copy entire script
New-DynamicDistributionGroup -Name "Branding Campaign Team" --RecipientFilter "(RecipientType -eq 'UserMailbox') -and (Department -like 'Marketing*' -or Department -like 'Sales*')" -RecipientContainer "India"
To create a dynamic Distribution group in Exchange Online:
- Select the Create Dynamic Distribution Groups option from Group Management in Office 365 tab.
- Select the desired Office 365 tenant, select the CSV file with the details of distribution groups to be created, and click Create.
» Start 30-day Free Trial
The PowerShell script mentioned above will create new dynamic distribution group named Branding Campaign Team, and will include users from marketing and sales department in India OU.
Limitations of creating dynamic distribution groups using PowerShell in Office 365 or Exchange Online.
- You will not be able to create distribution group using PowerShell unless you have the necessary permissions to create a distribution group, and also configure all the attributes used in the script. 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 create the group with different conditions or configure any other attributes of the dynamic distribution group, the script has to be modified or created again from scratch. With ADManger Plus, all properties can be configured at once.
- To bulk create dynamic distribution groups in Exchange Online or Office 365 from CSV, the script has to be modified. With ADManager Plus though, it is offered as a built-in option that's available by default.
- You must know how to run the scripts from the PowerShell window or command line. 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.