# Office 365 – msExchHideFromAddressLists does not synchronize with Office 365

In my life I’ve deployed multiple Office 365 tenants connected with Active Directory and I’ve been synchronizing msExchHideFromAddressLists field from…

blog

24 Mar 2020 fr

![Office 365 – msExchHideFromAddressLists does not synchronize with Office 365](/wp-content/uploads/2020/03/img_5e66909e8c4c3.png)

[Voir les images (6)](#pf-content-image-1-0)

In my life I've deployed multiple Office 365 tenants connected with Active Directory and I've been synchronizing **msExchHideFromAddressLists** field from Active Directory to **HiddenFromAddressListsEnabled** in Azure AD without any issues. Recently I was notified that **msExchHideFromAddressLists** is not getting properly synchronized and surely enough the issue was that **Exchange hybrid deployment** was not checked.

[!\[Azure AD Connect optional features with Exchange hybrid deployment enabled\](/wp-content/uploads/2020/03/img_5e66909e8c4c3.png)](/wp-content/uploads/2020/03/img_5e66909e8c4c3.png)

So you tick the checkbox do Initial sync and you're done.

```powershell
Start-ADSyncSyncCycle -PolicyType Initial
```

Except that it doesn't work.

```powershell
get-mailbox -Identity 'bartosz.klys@evotec.ooo' | Format-List *HiddenFromAddressListsEnabled*
```

Command above would still show **FALSE** for **HiddenFromAddressListsEnabled**. Quick check AD side and msExchangeHideFromAddressLists is **Enabled**.

```powershell
Get-ADUser -filter { userprincipalname -eq 'bartosz.klys@evotec.ooo' } -Properties msExchHideFromAddressLists
```

[!\[PowerShell output showing msExchHideFromAddressLists set to True\](/wp-content/uploads/2020/03/img_5e71ecb27dc3d.png)](/wp-content/uploads/2020/03/img_5e71ecb27dc3d.png)

So what to do?

### 💡 How to make sure HiddenFromAddressListsEnabled works as expected?

To make sure hidding mailboxes from **Global Address List (GAL)** works correctly you should verify few things

- 💡 Active Directory has Exchange Extended Schema – this can be done by downloading Exchange 2016 CU15 or similar and executing **Setup.exe /IAcceptExchangeServerLicenseTerms /PrepareSchema** command

[!\[Exchange Server setup preparing the Active Directory schema\](/wp-content/uploads/2020/03/img_5e791d91ca121.png)](/wp-content/uploads/2020/03/img_5e791d91ca121.png)

- 💡 Exchange hybrid deployment is selected in Azure AD Connect

[!\[Azure AD Connect optional features with Exchange hybrid deployment enabled\](/wp-content/uploads/2020/03/img_5e66909e8c4c3.png)](/wp-content/uploads/2020/03/img_5e66909e8c4c3.png)

- 💡 Run Initial Synchronization after any change of configuration

```powershell
Start-ADSyncSyncCycle -PolicyType Initial
```

- 💡 Update msExchHideFromAddressLists for each user that you want to hide from GAL (set TRUE as value)
- 💡 Refresh directory schema with any change to AD Schema

[!\[Azure AD Connect Additional tasks screen with Refresh directory schema selected\](/wp-content/uploads/2020/03/img_5e6690ea94af2.png)](/wp-content/uploads/2020/03/img_5e6690ea94af2.png)[!\[Azure AD Connect Refresh Directory Schema page\](/wp-content/uploads/2020/03/img_5e6691311107a.png)](/wp-content/uploads/2020/03/img_5e6691311107a.png)

All the steps above I've done and shown that it's not working. The final and **often omitted **step is what also needs to be set for each user

- 💡 Update **mailNickName** attribute to **proper**, **non-empty** value

Not so obvious right? Of course, if you have local **Exchange**, it would be done automatically, but most small Clients don't have resources to run an additional machine. While it's technically not a supported scenario, it's how most **SMB Clients** are working. Now we just need to fix all our users that have **Mail** field set, and are missing **MailNickName**.

```powershell
$WhatIf = $true
$Forest = Get-ADForest
foreach ($Domain in $Forest.Domains) {
    $Users = Get-ADUser -Filter { Mail -like '*' -and MailNickName -notlike '*' } -Properties mailNickName, mail,msExchHideFromAddressLists -Server $Domain
    $Users | Format-Table -AutoSize Name, SamAccountName, DisplayName, Mail,mailNickName, Enabled, msExchHideFromAddressLists,DistinguishedName
    foreach ($_ in $Users) {
        Set-ADUser -Identity $_ -Replace @{mailNickname = $_.SamAccountName } -Server $Domain -WhatIf:$WhatIf
    }
}
```

## Projets associés

Projets liés aux tags, catégories et au contenu de cet article.

[Tous les projets](/fr/projets/)

Recherche des projets associés...

[Retour au blog](/blog)

## Articles associés

- [Office 365 – Limiting license to minimum apps required](/fr/blog/office-365-limiting-license-to-minimum-apps-required/)
- [Azure ADConnect Export Failed – Permission-issue error](/fr/blog/azure-adconnect-export-failed-permission-issue-error/)
- [Syncing Global Address List (GAL) to personal contacts and between Office 365 tenants with PowerShell](/fr/blog/syncing-global-address-list-gal-to-personal-contacts-and-between-office-365-tenants-with-powershell/)

<!-- PowerForge markdown artifact sha256:98529F4CE72C94D167DF0A16E591734CEAD52E18302C0A7D8C6CB9A33FA52BBB -->
