# AD masquer un utilisateur de la GAL

MsExchHideFromAdressList (TRUE) , ne peut pas fonctionner sans MailNickname (première partie de l’adresse du compte).

showInAddressBook doit être supprimé

ou une règle AD connect (pas validé)

[Microsoft Entra Connect Sync: Configure filtering - Microsoft Entra ID](https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/how-to-connect-sync-configure-filtering#organizational-unitbased-filtering)

[How to hide users from the GAL in Office 365 synchronized from on-premises - Jack Stromberg](https://jackstromberg.com/2018/08/how-to-hide-users-from-the-gal-in-office-365-synchronized-from-on-premises/#comments)

Script pour compléter l’atribut MailNickname pour tous les comptes désactivés placés dans une OU spécifique :

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

[Attribute msExchHideFromAddressLists not always hiding email in GAL](https://community.spiceworks.com/topic/2003882-attribute-msexchhidefromaddresslists-not-always-hiding-email-in-gal)