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
