Share via


Dynamic Distribution Group User Count

Question

Thursday, June 28, 2018 1:31 PM

When I run this command on the exchange server and get a user count it is including more users than we should based on the filters.

Set-DynamicDistributionGroup -Identity Accounting@xyz.com -RecipientFilter {(CustomAttribute13 -eq "Accounting") -or (CustomAttribute13 -eq "Accounts Payable") -or (CustomAttribute13 -eq "Accounts Receivable") -or (CustomAttribute13 -eq "AP")}

When I run the following command I get a user count that exceeds what it should be:

# Count members of the distrogroup
$members = Get-DynamicDistributionGroup -Identity “Accounting”
(Get-Recipient -RecipientPreviewFilter $members.RecipientFilter -resultsize unlimited).count

The total user count is around 58000 users instead of around 30000 users. I have exported the user count to a csv file and I can see users included on the list that do not have CustomAttribute13 set to any of the values that I specified.

Any ideas?

ExchangeGuru

All replies (6)

Thursday, June 28, 2018 1:44 PM

Hi,

what does $members.RecipientFilter contain?

Evgenij Smirnov

I work @ msg services ag, Berlin -> http://www.msg-services.de
I blog (in German) @ http://it-pro-berlin.de
my stuff in PSGallery --> https://www.powershellgallery.com/profiles/it-pro-berlin.de/
Exchange User Group, Berlin -> https://exusg.de
Windows Server User Group, Berlin -> http://www.winsvr-berlin.de
Mark Minasi Technical Forum, reloaded -> http://newforum.minasi.com

In theory, there is no difference between theory and practice. In practice, there is.


Friday, June 29, 2018 7:55 AM

Hi ExchangeGuru,

Please run the following command to count again:

(Get-Recipient -RecipientPreviewFilter $members.RecipientFilter -OrganizationalUnit $Members.RecipientContainer -resultsize unlimited).count

Best Regards,
Niko Cheng
Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].


Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.


Wednesday, July 11, 2018 10:00 AM

Hi ,

I'm just writing to check how's everything going? If you have any questions or needed further help on this issue, please feel free to post back. If the issue has been resolved, please mark the helpful replies as answers, this will make answer searching in the forum easier and be beneficial to other community members as well. Thanks for your understanding.

Best Regards,
Niko Cheng
Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].


Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.


Wednesday, July 11, 2018 3:23 PM

I found the problem. I needed to add the following prior to running the count.

Set-ADServerSettings -ViewEntireForest $True

If not - it was not capturing the objects outside of my default domain.

ExchangeGuru


Wednesday, July 11, 2018 3:42 PM

I found the problem. I needed to add the following prior to running the count.

Set-ADServerSettings -ViewEntireForest $True

If not - it was not capturing the objects outside of my default domain.

ExchangeGuru

Hi,

from your OP the Problem seemed to be the other way around, though ;-)

However, Nikos recommendation is spot on - mostly the scope gets forgotten when enumerating members of a DDG by filter.

Evgenij Smirnov

I work @ msg services ag, Berlin -> http://www.msg-services.de
I blog (in German) @ http://it-pro-berlin.de
my stuff in PSGallery --> https://www.powershellgallery.com/profiles/it-pro-berlin.de/
Exchange User Group, Berlin -> https://exusg.de
Windows Server User Group, Berlin -> http://www.winsvr-berlin.de
Mark Minasi Technical Forum, reloaded -> http://newforum.minasi.com

In theory, there is no difference between theory and practice. In practice, there is.


Thursday, July 12, 2018 1:09 AM

Hi ExchangeGuru,

Glad you solved the issue, please mark it as an answer, this will make answer searching in the forum easier and be beneficial to other community members as well. Thanks for your understanding.

Best Regards,
Niko Cheng
Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].


Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.