Scroll Top

Hide users from GAL by OU using PowerShell

FI_Post_PowerShell

In this post I will show how you can hide users such as Ex-Employees, from your Global Address List (GAL). I came across this issue when our user automation software stopped setting the following user attribute to TRUE.

Open PowerShell and run:

PowerShell
Get-ADUser -filter * -searchbase "OU DN" | Set-ADUser -replace @{msExchHideFromAddressLists=$true}

Replace ‘OU DN’ with the distinguished name of the OU that you’d like to run this against.

Please note, to hide users from the GAL, you need to ensure that the mailNickname attribute is populated within Attribute Editor.