Change On Premise AD Attriburte (msExchHideFromAddressLists)

Emilio Baez Cintron 20 Reputation points
2024-07-18T18:32:45.3533333+00:00

I want to hide the all user mailbox for specific OU in the AD on Premise. I know how to do this on the exchange server, but I noticed in AD there is an attribute msExchHideFromAddressLists that is set to TRUE.

I want to use powershell to hide all user mailbox, form specific OU, but cannot find out how to change this to TRUE.

Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,598 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jake Zhang-MSFT 4,900 Reputation points Microsoft Vendor
    2024-07-19T02:54:33.73+00:00

    Hi @Emilio Baez Cintron,

    Welcome to the Microsoft Q&A platform!

    According to your description, you want to use PowerShell to update the "msExchHideFromAddressLists" attribute of all user mailboxes in a specific organizational unit (OU). You can use the following command format in PowerShell to complete it:

    Import the Active Directory module

    Import-Module ActiveDirectory

    Define the OU where the user mailboxes are located

    $OU = "OU=YourOU,DC=YourDomain,DC=com"

    Get all user mailboxes in the specified OU and hide them from the address lists

    Get-ADUser -Filter 'ObjectClass -eq "user"' -SearchBase $OU -Properties msExchHideFromAddressLists | ForEach-Object {

        Set-ADUser $_ -Replace @{msExchHideFromAddressLists=$true}

    }

    Please feel free to contact me if you have any queries.

    Best,

    Jake Zhang

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.