Exchange PowerShell: How to find users hidden from the Global Address List

Exchange PowerShell

Over the course of the next few weeks I’m going to look at using PowerShell for some fairly routine Microsoft Exchange and Active Directory tasks that I get asked to perform.

The aim is that by the end of the articles we have a series of PowerShell commands that can be built into a script to easily perform a brief audit of some common Exchange and Active Directory properties I get asked about.

I was recently asked by a customer to confirm all the mailboxes that are currently hidden from the Exchange Global Address List.

In the Exchange Management Console, this is indicated by a check box on a per mailbox basis.

Hide from Exchange address lists

But there is no way to produce a list from within the Exchange Management Console, and I don’t want to check every mailbox on the server.

As the value is part of a users mailbox it makes sense to check out the properties of the Get-Mailbox PowerShell cmdlet to see what the property is called. To do this we can pipe the Get-Mailbox cmdlet into the Get-Member cmdlet to list all it’s properties.

Get-Mailbox | Get-Member

This gives the following output:

get-mailbox get-member hiddenfromaddresslistenabledAs you can see there is a HiddenFromAddressListsEnabled property.

So all we have to do now is write a PowerShell command, that Gets the Mailbox Where the property HiddenFromAddressListsEnabled is True. The way PowerShell is designed, the cmdlets we need to use are almost the same as the spoken language.

So the command looks like this:

Get-Mailbox | Where {$_.HiddenFromAddressListsEnabled -eq $True}

get-mailbox where hiddenfromaddresslists is true

We’re not interested in the Alias or ProhibitSendQuota so we can further improve it and select just the users Name and the HiddenFromAddressListsEnabled value using the following command:

Get-Mailbox | Where {$_.HiddenFromAddressListsEnabled -eq $True} | Select Name, HiddenFromAddressListsEnabled

get-mailbox | where [$_.hiddenfromaddresslists -eq $True}

If you want to export the list to a file you can use the following command:

Get-Mailbox | Where {$_.HiddenFromAddressListsEnabled -eq $True} | Select Name, HiddenFromAddressListsEnabled | export-csv c:\temp\hiddenfromGAL.csv

The PowerShell command above works on both Exchange 2007 and Exchange 2010.

Related Posts:

1. How to install Exchange 2013 (SP1) on Windows Server 2012 R2

2. Exchange 2013 Initial Configuration Settings multi-part series

3. How to install Exchange 2010 (SP3) on Windows Server 2012

4. Exchange PowerShell: How to check the number of items in the Inbox, Sent Items, Deleted Items and Junk Email

5. Exchange PowerShell: How to enumerate and modify Distribution Group properties

If you found this post useful, please share!

    Related Posts

    3 thoughts on “Exchange PowerShell: How to find users hidden from the Global Address List

    Leave a Reply

    Your email address will not be published. Required fields are marked *