Making changes to Active Directory Attributes - PowerShell perhaps. RRS feed

  • Question

  • Hello.  

    I have about 180 people I need to make the following changes for.  Is there anyone who knows PowerShell script items that I can create to accomplish this?  

    msExchHideFromAddressLists – Set to True
    mailNickname to be set the same as samaccountname

    As a reference.  This is to stop Shared Mailboxes in our Office 365 listing all these accounts in GAL.  (AD Sync)

    Thanks in advance.


    Wednesday, July 22, 2020 5:47 PM

All replies

  • Try this:

    Get-Content FileOfSamAccountNames.txt |
            Set-Mailbox -Identity $_ -HiddenFromAddressListsEnabled:$true -Alias $_

    When you change the alias you may also cause a new e-mail address to be created. That won't remove the existing e-mail address that used the original alias. Whether or not any of that matters depends on your organizations address generation policies.

    --- Rich Matheisen MCSE&I, Exchange Ex-MVP (16 years)

    Wednesday, July 22, 2020 6:53 PM