Hi Mack,
During my tests I realized that getting it working takes a while. Question to you is, how are you testing if the Dynamic DL is working or not.
Use Get-OrganizationUnit cmdlet to confirm you are using the correct OU Name:
Get-OrganizationalUnit "contoso.com/IMP/Users/Test Users" | fl CanonicalName
CanonicalName : contoso.com/IMP/Users/Test Users
CAUTION: If you are testing using the RecipientPreviewFilter. As actual results would vary.
RecipientPreviewFilter extracts the filter from the group and expands it. If you note the OU scoping part is seperate for the DynDistGroup, hence when you test it using Preview, it will not scope the search to the OU but the ldap filter only.
New-DynamicDistributionGroup -IncludedRecipients MailboxUsers -Name "Mailbox Users DDG" -OrganizationalUnit "contoso.com/IMP/Users/Test Users"
[PS] C:\Windows\system32>$FTE = Get-DynamicDistributionGroup Mailbox*
[PS] C:\Windows\system32>Get-Recipient -RecipientPreviewFilter $FTE.RecipientFilter | ft Name,OrganizationalUnit
Name
OrganizationalUnit
----
------------------
Satyajit
contoso.com/IMP/Users/Admin
extest_2b3e7cde82ca4
contoso.com/IMP/Users/Test Users
SatyaTEST1
contoso.com/IMP/Users/Test Users
ExAdmin2
contoso.com/Test Users
SatyaTEST2
contoso.com/IMP/Users/Test Users
SatyaTEST3
contoso.com/Users
[PS] C:\Windows\system32>$FTE.RecipientFilter
((RecipientType -eq 'UserMailbox') -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')) -and (-not
(RecipientTypeDetailsValue -eq 'MailboxPlan')) -and (-not(RecipientTypeDetailsValue -eq 'DiscoveryMailbox')) -and (-not(
RecipientTypeDetailsValue -eq 'PublicFolderMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')))
[PS] C:\Windows\system32>
But when you email to the group the email goes smooth only to the group base OU users not the full list as seen above.
The value of the RecipientContainer parameter can be the canonical name of an organizational unit (OU) or a domain.
If you don't specify a value for the RecipientContainer
parameter, the cmdlet will default to use the local container and Sub-OUs.
This location is specified by using the OrganizationalUnit parameter.
Now tested with case similar as yours with Users elsewhere, Group base OU elsewhere; Then used -RecipientContainer to change the OU scope. Again works just fine, email received only by selective users. NOTE the Shell preview still lists everyone.
References:
View members of a dynamic distribution group
https://technet.microsoft.com/en-us/library/bb232019(v=exchg.150).aspx
New-DynamicDistributionGroup
https://technet.microsoft.com/en-us/library/bb125127(v=exchg.150).aspx
How to Create a New Dynamic Distribution Group(Read Last para:- -RecipientContainer is needed in combination with the -OrganizationalUnit switch.)
https://technet.microsoft.com/en-us/library/aa996561(v=exchg.80).aspx
Dynamic Distribution Lists not working as expected (0 recipients during mail routing)
https://www.corelan.be/index.php/2008/11/05/dynamic-distribution-lists-not-working-as-expected-0-recipients-during-mail-routing/