Exchange: Hide users in an Organizational Unit from the address book

In a company that manages an on-premises Exchange installation, it is common practice to keep the accounts of users who leave the company active for a few weeks after they leave.

Often, these user accounts are moved to an organizational unit with their accounts disabled, yet they still appear in the company’s Exchange address book.

If the number of users is small, you can hide them from the address book using the ECP, but when personnel changes involve dozens or even hundreds of accounts, doing this one by one is quite tedious.

trueYou can do this with PowerShell by modifying the usermsExchHideFromAddressLists attribute, which must be set to .

To hide users from an OU, simply list them and modify the attribute—this can be done in a single line:

Get-ADUser -filter * -searchbase "OU=UsersLeft,DC=corp,DC=lan" | Set-ADUser -replace @{msExchHideFromAddressLists=$true}

Replace the DN of the organizational unit

Romain Drouche

Romain Drouche

Architecte Système | MCSE: Core Infrastructure

Expert en infrastructures IT avec plus de 15 ans d'expérience sur le terrain. Actuellement Chef de projet Systèmes et Réseaux et Référent SSI (Sécurité des Systèmes d'Information), je mets mon expertise au service de la fiabilité et de la sécurité des environnements technologiques.

GHinM▶