question

MichelFournier-1008 avatar image
0 Votes"
MichelFournier-1008 asked AshokM-8240 commented

Exchange 2010 - Dynamic Distribution Lists

I would like to know what would be the best way to exclude from a distribution list - users that their AD accounts are disabled and their exchange account are hidden from GAL and a message delievry restrictions has been added "Only senders in the following list"(due that we currently cannot delete any accounts and needed to stop all mail flow).


office-exchange-server-administrationoffice-exchange-online-itprooffice-exchange-server-mailflowoffice-exchange-server-itpro
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AshokM-8240 avatar image
0 Votes"
AshokM-8240 answered AshokM-8240 commented

Hi,

Could you please share the detailed version of your exchange server?

Get-Exchangeserver | select name,admindisplayversion

Please note that Exchange 2010 support is till October 2020, so plan for the upgrade of exchange to the supported versions.

If I understood correctly, you are looking to exclude the users in dynamic distribution lists. Disabled AD accounts, hidden from GAL accounts. If so, please try the below command to exclude the disabled AD accounts in dynamic distribution lists,

Set-DynamicDistributionGroup -name "New List " -RecipientFilter {((RecipientType -eq 'UserMailbox') -and (HiddenFromAddressListsEnabled -eq 'True'))}

Set-DynamicDistributionGroup -name "New List " -RecipientFilter {((RecipientType -eq 'UserMailbox') -and -not(UserAccountControl -like 'AccountDisabled') )}

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Just checking to see if there are any updates. Please feel free to mark the suggestions as answers if it was helpful or let us know if you would like further assistance.

0 Votes 0 ·
KaelYao-MSFT avatar image
0 Votes"
KaelYao-MSFT answered KaelYao-MSFT commented

Hi,
You can use the UserAccountControl propertity of the recipientfilter parameter.
For example, there is a list containing all the members in the Organizational Unit “IT support”.
The following command excludes users whose accounts have been disabled in the Active Directory.

 Set-DynamicDistributionGroup –identity <GroupName> -RecipientFilter{(RecipientType –eq “Usermailbox”) -and (UserAccountControl –ne “AccountDisabled,NormalAccount”)} –RecipientContainer “contoso.com/IT support”

You can also use the following command to exclude users by their names:



   Set-DynamicDistributionGroup -Identity <GroupName> -RecipientFilter {((RecipientType -eq 'UserMailbox') -and -not(Name -like '<User_to_be_exclude>'))}

In additional, based on my research, disabling the users’ mailboxes will also take effect.
While it may remove the users from not only a dynamic distribution list but all the other address lists and stop the mail flow to these mailboxes.
And it will also delete all the Exchange related attributes of the user in active directory.

Here is the test in my lab:
I created a dynamic distribution group named IT group. It contains users who are in the IT department.
DLmember.ps1 is a script to get all the users in this dynamic distribution group. Currently there are two users, IT1 and IT2.
18188-001.png


When a message is send to this group, both users will receive the mail.
18177-002.png

If IT1’s mailbox is disabled, it will be removed from the dynamic distribution group.
18229-003.png

And will no longer receive mails which are sent to this group.
18257-004.png



001.png (2.0 KiB)
002.png (11.2 KiB)
003.png (12.0 KiB)
004.png (10.0 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Just checking in to see if above information was helpful.
Please let us know if you would like further assistance.

0 Votes 0 ·