Creating Exchange dynamic distribution groups with custom attributes

You learn something new every day… I guess that means I’m ahead of schedule for the day.

A coworker asked if there was a way to use PowerShell to create a dynamic distribution group using one of the AD customAttributeX values. I didn’t know the answer offhand (since I create new distribution groups about every 5 years), but a little binging turned up the documentation for New-DynamicDistributionGroup. Turns out that the ConditionalCustomAttributeN parameters will do what he wanted:

New-DynamicDistributionGroup -IncludedRecipients mailContacts -ConditionalCustomAttribute6 "PeopleToInclude"

It turns out that wasn’t what he really wanted– he wanted to create a dynamic DG to include objects where the custom attribute value was not set to a particular value. The ConditionalXXX switches can’t do that, so he had to use a RecipientFilter instead:

New-DynamicDistributionGroup -IncludedRecipients mailContacts -RecipientFilter {ExtensionCustomAttribute6 -ne "PeopleToExclude"}...

Advertisements

1 Comment

Filed under Office 365, UC&C

One response to “Creating Exchange dynamic distribution groups with custom attributes

  1. Archie

    Hi, i was wondering if you can help me on my existing issue. I am not a PoweShell guy but i have a request to create a Dynamic Distribution Group on Office 365. Currently our setup is AD inside the domain/network and replicated thru DirSync Server to our Office 365.

    My challenge is to create a DDG on the ff. criteria.
    1. Create a DDG from a security group that was created inside the domain
    – is it possible to create a DDG from a security group?
    – is this possible? if not, what is the best recommendation?

    2. Create a DDG with Filters of M(male) and F(female)
    – is it possible to filter and create a DDG based on Gender?

    Thanks so much in advance!!!!

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s