Freigeben über


Dynamic Distribution Group creation tool (PowerShell command generator to create Distribution Groups)

I. Introduction

See the Download section below for the link to download the tool.

In Exchange 2010/2013/2016 and Exchange Online (the messaging component of Office 365), we can create Dynamic Distribution Groups in two ways :

  1. Using the Exchange Administration Console (HTML based)
  2. Using the Exchange Management Shell (Command line based)

More information about the ways to create and manage Dynamic Distribution Groups on this link

The Dynamic Distribution Groups are a type of group that base their memberships on a query on other mail-enabled objects such as User Mailboxes, Room Mailboxes, or any object stamped with an e-mail address and that Exchange Server can read.

NOTE: When we use PowerShell to create a Dynamic Distribution Group, if we don’t specify the Scope of the query of a Dynamic Distribution Group, by default the scope will be the location where the Dynamic Distribution Group is created => and this is often something that takes hours until we found the cause of “non-working” Dynamic Distribution Groups, because everything else look very normal about these.

The tool I am giving here is meant to generate the PowerShell (Exchange Management Shell actually because you need the Exchange Tools to make it work) command line to create a Dynamic Distribution Group, without forgetting to specify the “scope” of the Dynamic Distribution Group filter.

Also, the other command line generated is meant to modify the scope and the filter of an exising Dynamic Distribution Group.

This is an Excel based PowerShell command generator, next challenge is to do the same but with WPF ! That will be for another blog post !

II. Tool description

a. General overview

clip_image002

The tool is composed of 2 main parts:

  1. The input part, where we define the Dynamic Distribution Group scope, its location (an Organizational Unit), its name, optionally its Alias (that is what is used to generate the Dynamic DG e-mail address) – if you don’t specify it, Exchange will automatically convert the name into an alias, replacing all spaces and special characters with an hyphen or a dash (“-“).
  2. The PowerShell command part, that you will copy and paste on an Exchange PowerShell window to create or modify your Dynamic Distribution Group. There are 2 command lines in that part :

a.

 New-DynamicDistributionGroup

-> that is to create a new Dynamic Distribution Group with the parameters you chose on the part #1 – Input part.
b.

 Get-DynamicDistributionGroup

-> that is to modify an existing Dynamic Distribution Group with the scope and filter parameters you chose on the part #2 – Input part.

b. Input details

See the below schema for the explanation of each input part.

clip_image004

c. Command part details

See the below schema for the explanation of the two PowerShell command lines.

clip_image006

III- Using these to create a new Dynamic DG or modify an existing Dynamic DG

NOTE: for this last part, you need the following skills : ability to copy and paste things

Once you have your command line ready, that are generated by the tool based on the input parameters you chose, just copy one of the command lines, and paste it on a script, or directly on the Exchange Management Shell.

Example, I want to create a new Dynamic Distribution Group with the sample options of the screenshots above :

- Step #1 : Select the blue box and hit CTRL + C clip_image008

- Step #2 : Paste the command

You can choose either to paste the command on a Notepad to save it later as a .PS1 script:

clip_image010

Or you can paste it on a PowerShell ISE window on your remote connected server:

clip_image012

Or you can directly paste it on an Exchange Management Shell window (WARNING: this will execute your command as well):

clip_image014

And that applies for both of the blue boxes containing the New-DynamicDistributionGroup / Set-DynamicDistributionGroup commands.

 

IV- Download link

Of course you can use it to create a base command line, and then add all the options you want to customize your Dynamic Distribution Groups, the tool just generates the basics of a Dynamic Distribution Group creation and only modifies the scope and filter … for example we don’t set any delivery restrictions, owners, etc…, just the basics.

You can DOWNLOAD this Excel tool here.

Have a good one !
Cheers
Sam