Exchange PowerShell: Find users hidden from the Global Address List

0

Hello All,

In today's post, we will see seeing how to find the users hidden from the Global Address List of Exchange Server. If you are following along my previous posts, you must be aware of the articles that I have written articles which are useful for auditing purposes all using Powershell cmdlets. These can all be used together in your daily activities and you can make scripts combining all of them together.

You can see various posts like finding Finding Expired Accounts, Finding Empty Groups in Active Directory, Listing all SMTP addresses in Exchange and lots more.

I was recently given the task of finding the user email accounts that are hidden in Exchange for some reason or the other. And I thought of doing this the easy way - Powershell way!

You can see the same through the Exchange Management Console as well. I have shown an example below, it is a check mark that is ticked to hide the account.

Exchange PowerShell: Find users hidden from the Global Address List

Since there is no way to export all the accounts from the Exchange Management Console, I wouldn't want to do this on each and every mailbox.

So we will be performing this activity with the help of Exchange Management Shell. Since we are finding the details about the mailboxes, let us see the associated properties with it. To do so, type the below:

Get-Mailbox | Get-Member

Exchange PowerShell: Find users hidden from the Global Address List

You can see below that I have highlighted a property called HiddenFromAddressListsEnabled and it has two values associated with it, which are True and False.

So now that we know the property, we have to query the mailboxes where the property HiddenFromAddressListsEnabled is set to true. Therefore the command will look like below:

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

We just want the output to consist of Name of the Mailbox and the HiddenFromAddressListsEnabled property to be shown in the output, we will do so using the select cmdlet.

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

Now let us say we want to submit this to your boss, you can simply use Export-csv cmdlet to do so.

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

That is all I have for today, I hope this was informative and thank you for reading!

Share.

About Author

I am Adil Arif, working as a Senior Technical Support Engineer at Rubrik as well as an independent blogger and founder of Enterprise Daddy. In my current role, I am supporting infrastructure related to Windows and VMware datacenters.

Leave A Reply