Hide from address list not working in Azure Active Directory Synced environment

When setting up Hide from address lists in Azure AD Connect environment by setting msExchHideFromAddressLists to True, in exchange online is still not enabled.

clip_image002

To set the above attribute true via PowerShell, you can run the below commands

$user = Get-ADUser username –Properties *
$user.msExchHideFromAddressLists = “True”
Set-ADUser –Instance $user

Run the delta sync to update the attribute in Azure Active Directory Start-ADSyncSyncCycle -PolicyType Delta and wait for couple of minutes. Checked the user mailbox and Hide from address list is still unchecked

clip_image004

Checked on premises Active Directory and mailNickName attribute was not populated on user account. The mail nickname should be populated for every users in on premises Active Directory.

Set the mailNickname with alias of the user, set the msExchHideFromAddressLists set to True and run Delta sync, wait for couple of minutes and now user mailbox is hidden in the GAL in Office 365.

Conclusion:

1. It seems msExchHideFromAddressLists attribute is flowed by the Exchange Synchronization Rule

2. Most of the time mailNickname is not populated for the user objects, hence before starting the migration to Office 365, make sure that mailNickname is populated for all the users

3. This synchronization rule has a scoping filter which only applies the rule if the mailNickname IsNotNull

4. Run IdFix Directory Synchronization Error Remediation Tool to find any issues

Just FYI, if you want to update mail and mailNickname for all users in OU
Get-ADUser -Filter * -SearchScope Subtree -SearchBase “OU=OUName,DC=domain,DC=com” |  Foreach-Object {Set-ADUser -Identity $_ -Email “$($_.samaccountname)@domain.com” }

Get-ADUser -Filter * -SearchScope Subtree -SearchBase “OU=OUName,DC=domain,DC=com” |  ForEach-Object {Set-ADUser -Identity $_ -Replace @{mailNickname=$_.samaccountname}}

Cheers,

Posted in:
About the Author

Gulab Prasad

Technology Consultant & Blogger

MCSE: Exchange Server 2016, 2013
MCSE: Skype for Business Server 2015
MCSE: Azure Productivity
MCSE: Windows Server 2016
MCSA: Windows Server 2012, Office 365
MCITP: Exchange Server 2010-2007 | Lync Server 2010
VMware: vSphere 6 Foundations

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress spam blocked by CleanTalk.