Mobile Phone Dynamic Distribution Group

The other day, the boss came to me and asked me to setup a distribution list for everyone who has a company issued phone.

GREAT, I don’t want to manage this distribution list.

Luckily for me, only users who have been issued company phones have their mobile numbers in Active Directory, so off to PowerShell I go.

All I need to do is create a dynamic distribution group, which with the GUI in Exchange 2010 is pretty limited, so as previously mentioned, I’ll have to use PowerShell. But what is a dynamic distribution group? I’ll let Microsoft Explain it:

Dynamic distribution groups are mail-enabled Active Directory group objects that are created to expedite the mass sending of email messages and other information within a Microsoft Exchange organization.

Unlike regular distribution groups that contain a defined set of members, the membership list for dynamic distribution groups is calculated each time a message is sent to the group, based on the filters and conditions that you define. When an email message is sent to a dynamic distribution group, it’s delivered to all recipients in the organization that match the criteria defined for that group.

So there you have it, this is exactly what I am looking for, and PowerShell is the way I am going to do it.

Firstly, I’ll give a name of the dynamic distribution group, in this case “iUsers Mobile”

Get-DynamicDistributionGroup "iUsers Mobile"

Now, I’ll need to set the filter that I want for this dynamic distribution group, in this case, obviously it will be the mobile number. Since all mobile numbers start with a 0, using –like “0*” will match all numbers in the MobilePhone AD field with a wildcard for any combination of numbers after the leading 0.

Set-DynamicDistributionGroup -RecipientFilter {MobilePhone -like "0*"}

Pipe them both together and now I have a 1 liner that will assist with my desire to NOT have to manage this distribution group.

Get-DynamicDistributionGroup "iUsers Mobile" | Set-DynamicDistributionGroup -RecipientFilter {MobilePhone -like "0*"}

So there you have it, any comments and questions are welcome.

Titan Solutions


About Phill McSherry
Phill McSherry has been working in the Australian IT industry for over 20 years and is the technical manager and solutions architect for managed services provider Titan Solutions -

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: