skip to Main Content

A Dynamic Distribution Group‘s (DDG) is composed from members that meet a certain criteria.
For example, if the Department is IT and if the DDG is based on IT Department, then, all the members that meet that condition are added to that list.

Unlike a regular DG, a DDG doesn’t show the members. It only adds them when a E-mail is send to that DDG.
Another difference is the fact that DDG’s are created using PowerShell (PS).
In Office 365 Preview we now have the option to create a DDG by using a GUI.

How to create a DDG ?

  • Connect to Exchange using PS:

#———————————————————————————
# Author:      Alexandru Dionisie
# Website:     www.cosmintataru.ro
# Script Name: Sesiune_Noua.ps1
#———————————————————————————
#
#
# 1.Ask credentials for authentication
$LiveCred = Get-Credential
# 2.Open a new session
$AlexD = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
# 3.Join the session
Import-PSSession $AlexD

How to create a Dynamic Distribution Group ?

  • Use the New-DynamicDistributionGroup cmdlet to create a new DDG:

To find out more about the New-DynamicDistributionGroup cmdlet arguments, type Get-Help New-DynamicDistributionGroup in PS.

How to create a Dynamic Distribution Group ?

Now, getting back to DDG, run the following cmdlet:

#———————————————————————————
# Author:      Alexandru Dionisie
# Website:     www.cosmintataru.ro
# Script Name: DDG.ps1
#———————————————————————————
#
# Create new DDG for IT Department
New-DynamicDistributionGroup -Name „Support Department” -Alias „ITSupport” -IncludedRecipients „AllRecipients” -ConditionalDepartment „IT”

How to create a Dynamic Distribution Group ?

Other useful cmdlets for DDG:

  • Show a list of all DDG: Get-DynamicDistributionGroup

How to create a Dynamic Distribution Group ?

  • Remove a DDG: Remove-DynamicDistributionGroup -Identity „ITSupport”

How to create a Dynamic Distribution Group ?

Since the members list it’s now shown in ECP, we can use PS to get it.

How ?

  • use the Get-Recipient cmdlet with the -RecipientPreviewFilter argument:

#———————————————————————————
# Author:      Alexandru Dionisie
# Website:     www.cosmintataru.ro
# Script Name: DDG_Members.ps1
#———————————————————————————
#
# Get list of DDG members
# Store DDG object in the variable $DDGM
# Support Department – DDG alias
$DDGM = Get-DynamicDistributionGroup „Support Department”
# List the recipients that match the criteria defined for the DDG
Get-Recipient -RecipientPreviewFilter $DDGM.RecipientFilter

How to create a Dynamic Distribution Group ?

As we can see, the Support Department DDG, we have only two mailboxes that meet the criteria.

To export a list of all members,  we have to append a Export cmdlet to the above code:

#———————————————————————————
# Author:      Alexandru Dionisie
# Website:     www.cosmintataru.ro
# Script Name: DDG_Members.ps1
#———————————————————————————
#
# Get list of DDG members
# Store DDG object in the variable $DDGM
# Support Department – DDG alias
$DDGM = Get-DynamicDistributionGroup „Support Department”
# Export $DDGM variable results to CSV file
Get-Recipient -RecipientPreviewFilter $DDGM.RecipientFilter | Export-Csv C:\DDGM.csv

The CSV file contains more informations about the mailboxes: E-mail address, Name, department, etc.

How to create a Dynamic Distribution Group ?

Downloads:

DDG.ps1 DDG_Members.ps1
(Visited 6 times, 1 visits today)

Cosmin Tătaru

Pasionat de blogging și tehnologie încă din 2009, Cosmin este aici să vă ajute să vă creșteți vânzările și productivitatea punând tehnologia la treabă pentru dumneavoastră.

Suport-Clienti
Mergeți sus