Tuesday, January 8, 2013

Dynamic Distribution Groups with MultiValued Attribute

Ever wondered how to use the Multi-Valued Attributes in Exchange 2010 SP2 (or above) with Dynamic Distribution Groups? The following example shows you how to do this:

First we use 3 users and set their ExtensionCustomAttribute1 attribute to something we want to use:
Set-Mailbox User1 -ExtensionCustomAttribute1 Area1,Area2,Area3
Set-Mailbox User2 -ExtensionCustomAttribute1 Area2,Area3,Area4
Set-Mailbox User3 -ExtensionCustomAttribute1 Area3,Area4,Area5

Now we create our dynamic groups based on the information we want to “filter”:
New-DynamicDistributionGroup -Name Area1 -RecipientFilter {ExtensionCustomAttribute1 -eq “Area1”}
New-DynamicDistributionGroup -Name Area2 -RecipientFilter {ExtensionCustomAttribute1 -eq “Area2”}
New-DynamicDistributionGroup -Name Area3 -RecipientFilter {ExtensionCustomAttribute1 -eq “Area3”}

If we want to make sure they are working as expected, we can easily return each group’s members:
$Group = Get-DynamicDistributionGroup Area1
Get-Recipient -RecipientPreviewFilter $Group.RecipientFilter

In the example above the group:
• Area1 will have User1;
• Area2 will have User1 and User2;
• Area3 will have User1, User2 and User3.

No comments:

Post a Comment