MSExchangeGuru.com

Learn Exchange the Guru way !!!

 

Exchange 2016 Dynamic distribution Group returning all users using filter RecipientContainer

When you create a Query Based distribution list or Dynamic Distribution group in Exchange 2016 using the RecipientContainer the preview tab is missing.

However, if we use a Query like the following it will return all users in the organization and not the one’s meeting the criteria – RecipientContainer equals “MSExchangeGuru.local/Management/Chicago”, it will return all users in the Organization. The reason for this is because the Query doesn’t honor the OrganizationalUnit parameter.

Before we proceed, if you need help with creating Dynamic Distribution Groups in Exchange 2016, check this out: https://msexchangeguru.com/2017/11/17/create-ddg-e2016/

In the past, the query used to find Dynamic distribution Group members looked like this:

#######################

$Members = Get-DynamicDistributionGroup -Identity “Marketing Department DDL”

Get-Recipient -RecipientPreviewFilter $members.RecipientFilter | select Displayname,PrimarySmtpAddress

Or if you want to find the count

Get-Recipient -RecipientPreviewFilter $members.RecipientFilter | Measure-Object

#######################

For QBDL DDL – 2003 and prior

Get-Recipient -RecipientPReviewFilter (Get-DynamicDistributionGroup -Identity “Marketing Department DDL”).LDAPRecipientFilter | Select Name,PrimarySMTPAddress

#######################

To resolve this issue:

Going forward once you create a dynamic distribution Group with Exchange 2016, use the following query to find members

$DDL = “Marketing Department DDL”

Get-DynamicDistributionGroup $DDL | ForEach {Get-Recipient -RecipientPreviewFilter $_.RecipientFilter -OrganizationalUnit $_.RecipientContainer} | Select DisplayName,PrimarySMTPAddress | Format-Table

Or if you want to find the count

Get-DynamicDistributionGroup $DDL | ForEach {Get-Recipient -RecipientPreviewFilter $_.RecipientFilter -OrganizationalUnit $_.RecipientContainer} | Measure-Object

Ratish Nair

Microsoft MVP

Team @MSExchangeGuru.com

Leave a Reply

Categories

Archives

MSExchangeGuru.com