Hide AD disabled users from the Exchange Gallery

If you are trying to clean up your exchange gallery by removing those users you have disabled but not deleted. As a policy I always keep the mailbox around for a month (space allowed, of course) or so if management needs certain emails or anything else. Here’s a great command to use in EMS. Confirmed working in Exchange 2010 and 2013: AD Disabled but GAL enabled Get-Mailbox -Filter{(HiddenFromAddressListsEnabled -eq $false) -AND (UserAccountControl -eq "AccountDisabled, NormalAccount")} | set-mailbox -HiddenFromAddressListsEnabled $true 1 Get-Mailbox -Filter{(HiddenFromAddressListsEnabled -eq $false) -AND (UserAccountControl -eq "AccountDisabled, NormalAccount")} | set-mailbox -HiddenFromAddressListsEnabled $true What I recommend is that you run the first part of the command first to verify the list of user accounts is what you expect: List of accounts AD disabled but GAL enabled Get-Mailbox -Filter{(HiddenFromAddressListsEnabled -eq $false) -AND (UserAccountControl -eq "AccountDisabled, NormalAccount")} 1 Get-Mailbox -Filter{(HiddenFromAddressListsEnabled -eq $false) -AND (UserAccountControl -eq "AccountDisabled, NormalAccount")} If everything looks good go ahead and run the full...

Read More