Category Archives: [email protected]

Microsoft [email protected] posts

Dynamic Distribution Groups

Wouldn’t it be nice to have email distribution groups that automatically change themselves to reflect changes within your organisation?

With [email protected] ‘s Dynamic Distribution Groups, DDG, that is now possible.

The functionality for creating these is not exposed through the web interface so you do have to get stuck into PowerShell.

First of all you need to connect to your tenant:

Open a PowerShell command window and use the following code this will prompt you with a pop-up to enter the required credentials and then log you in.

$Cred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic –AllowRedirection
Import-PSSession $Session

Once you are connected issue the following command to create a DDG:

New-DynamicDistributionGroup -Name “All Foo Staff” -RecipientFilter {(RecipientType -eq ‘UserMailbox’) -and (Company -like ‘Foo Company’)}

Now when you send an email and the “To” field contains “All Foo Staff” and email will be sent to everyone who’s Company field is populated with “Foo Company”

If you want to display the current members who match this DDG use:

$AllFooStaffDDG = Get-DynamicDistributionGroup “All Foo Staff”
Get-Recipient -RecipientPreviewFilter $AllFooStaffDDG.RecipientFilter -OrganizationalUnit $AllFooStaffDDG.OrganizationalUnit

Disconnect from your tenant:

get-PSSession | remove-PSSession

Some websites to help you with this:

http://technet.microsoft.com/en-us/library/bb232019.aspx

http://help.outlook.com/en-us/140/dd264647.aspx – Lists other filter options

Due to the fact that the DDG is evaluated everytime it’s run any new member of staff that is added to the companies [email protected] tenant will be automatically included in the DDG if their attributes, in this case company field, matches.