How to hide all users in a particular OU in the Global Address List

Had this case where a company bought a company, and they wanted all the users created in their environment to begin migration af mails, but as the comunicated over email with the company the bought, it was essential that the users created, would not show up in Outlook, so they may choose the “wrong” user that had to be migrated, thus not capable of reading the mails sent to the new account.

An easy task to accomplish this, it just to hide the users from the Global Address List (GAL), this can be done manually, but a foolish task when you have hundreds of users.

Here powershell compes into play:

Hide the users in the OU:
Get-ADUser -filter * -searchbase “OU=NEWGROUP,DC=MARTINSBLOG,DC=local” | Set-ADUser -replace @{msExchHideFromAddressLists=$true}

Show the users in the OU:
Get-ADUser -filter * -searchbase “OU=NEWGROUP,DC=MARTINSBLOG,DC=local” | Set-ADUser -replace @{msExchHideFromAddressLists=$false}

Remember you have to wait for users to vanish or show, as GAL updates once a day 🙂

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close