Dynamic Distribution Group - Filter Preview shows fewer recipients than listing group members

I have a Dynamic Distribution Group in Exchange 2010. The only recipient filter I've added to it is to exclude mailboxes with a specific custom attribute on them (effectively it is excluding 1 mailbox for my purposes).

From the Exchange 2010 EMC, if I open up the properties of the Dynamic Distribution Group and go to Filter tab and click "Preview", I see the proper recipients (about 250 of them it looks like).

However, if I go to manage this group in OWA, or I run a powershell query with Get-Recipient -RecipientPreviewFilter $GroupName.RecipientFilter, it will list like 900 recipients.

How can I get an accurate report of the recipients? Because I cannot export from the Filter > Preview button.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

imkotteesSenior Messaging EngineerCommented:
hi, this should help you to export all the members

$members = Get-DynamicDistributionGroup -Identity "dynamicgroupname"
Get-Recipient -RecipientPreviewFilter $members.RecipientFilter > membersall.txt
garryshapeAuthor Commented:
I tried that but it outputs more members than what I show in the EMC Filter > Preview.

It's odd that members/recipients show up in the command output that don't even exist in the OU that the DDG filter is applying to.

Is this a bug or something because it's not pulling the right recipients from the scope/OU the filter is applying to? Something maybe to do with how the filter may not be applying until an email to the DDG hits the Transport server?
imkotteesSenior Messaging EngineerCommented:
can you please post the filter over here...
garryshapeAuthor Commented:
Ok here's one example without even having a recipient filter and output of recipients is inconsistent.

I created a new DynamicDistributionGroup called DDGTest2.

The Filter tab on its properties is set to container domain.com/company, and the following specific types are selected:
"Users with Exchange mailboxes"
"Users with external e-mail addresses".

If I click Conditions tab, nothing is checked.

When I click "Preview" at the bottom of the Conditions tab, all the intended mailboxes appear accordingly, no issues here.

Now if I run the Powershell commands:

$ddg2 = Get-DynamicDistributionGroup "DDGTest2"
Get-Recipient -RecipientPreviewFilter $ddg2.RecipientFilter | select Name,OrganizationalUnit > DDG2_Recipients.txt

Open in new window

and open the text file output, there are mailboxes from all over AD, not just inside the specified filter container "domain.com/company" but all OUs within "domain.com".

This is why it's confusing to me on how to verify who its going to.
garryshapeAuthor Commented:
The resolution was to specify the OrganizationalUnit with the get-recipient cmdlet, specifying the same OU that the filter of the DDG was applying to.

So this code:
Get-Recipient -OrganizationalUnit "domain.com/OU" -RecipientPreviewFilter $ddg.RecipientFilter > H:\DDG.txt

Open in new window

is what worked.

Get-Recipient -RecipientPreviewFilter $ddg.RecipientFilter > H:\DDG_No_Ou.txt

Open in new window

returned results for everyone in the domain even though the Dynamic Distribution Group doesn't "contain" those people via its filter.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.