Good thing I fired up an Exchange server this week’s for my PowerShell class. Here is a quick answer to a problem one of the my class attendees had. How to hide someone from the Global Address List (GAL) using PowerShell. In the Exchange Admin Center, you can configure this in the user’s mailbox general properties.
We had a discussion about what is in the GUI and what is in PowerShell. The direction that Microsoft is moving is a GUI free environment, at least on the servers. PowerShell is designed to do what the GUI can, and cannot do. We simply need to find the path. Fortunately, the path to success on this one was simple.
1 2 | Get-Mailbox -Identity jyoder | Set-Mailbox -HiddenFromAddressListsEnabled $True |
Line 1 will get the mailbox object of the user in question and pipe the object to line 2.
Line 2 uses the Set-Mailbox cmdlet and it’s HiddenFromAddressListEnabled property. When set to $True, the address is hidden. Let’s take a look at the results in Outlook.
Before executing this code, you can see that I was able to successfully find my email address in the GAL.
And this is the result after.
If you try to set the property to a setting that it already has, you will receive this message:
WARNING: The command completed successfully but no settings of 'Adatum.com/Users/Jason A. Yoder' have been modified.
Comments