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 🙂