The default Global Address List in an Exchange 2007 or Exchange 2010 organization includes all mail-enabled objects. It does this using the following recipient filter:
((Alias -ne $null) -and (((((((((((ObjectClass -eq 'user') -or (ObjectClass -eq 'contact '))) -or (ObjectClass -eq 'msExchSystemMailbox'))) -or (ObjectClass -eq 'msExchDynamicDi stributionList'))) -or (ObjectClass -eq 'group'))) -or (ObjectClass -eq 'publicFolder')) ))
You can see that the following object classes are included:
- User
- Contact
- System Mailbox
- Dynamic Distribution Group
- Group
- Public Folder
In some environments it may be desirable to exclude Mail Users. Mail Users are similar to Contacts in that they do not have a mailbox in the local Exchange organization, however unlike Contacts they do have a user account in Active Directory.
In other words, Mail Users are mail-enabled user objects that use an external email service.
Mail Users are displayed in the same area of the Exchange Management Console as regular Contacts, which may lead you to think that excluding them from the Global Address List is as simple as removing this part of the recipient filter:
-or ObjectClass -eq ‘Contact’
However that is not correct, and will not remove Mail Users from the Global Address List. To understand how to actually do this take a closer look at the attributes of a Mailbox User and a Mail User.
[PS] C:\>get-mailbox "John Smith" | fl objectclass, recipienttype
ObjectClass : {top, person, organizationalPerson, user}
RecipientType : UserMailbox
[PS] C:\>get-mailuser "Peter Banes" | fl objectclass, recipienttype
ObjectClass : {top, person, organizationalPerson, user}
RecipientType : MailUser
Notice that both are the same ObjectClass of ‘user’, which would still be included in the recipient filter if you were to simply remove the ‘Contact’ object class.
Instead, to remove Mail Users from the Global Address List you should exclude them by Recipient Type. You can do this by including the following condition in your recipient filter:
RecipientType -ne ‘MailUser’
For example:
Set-GlobalAddressList "Default Global Address List" -RecipientFilter {(Alias -ne $null -and RecipientType -ne 'MailUser' -and (ObjectClass -eq 'user' -or ObjectClass -eq 'Contact' -or ObjectClass -eq 'msExchSystemMailbox' -or ObjectClass -eq 'msExchDynamicDistributionList' -or ObjectClass -eq 'group' -or ObjectClass -eq 'publicFolder'))}
If you’re making this change to the default Global Address List see my previous post with the solution to the error that occurs when modifying the default Global Address List.




How exactly did you “remove” this person from the Global Address List? Knowing that will determine where to go next.
I excluded the MailUser recipient type from the GAL query, ie the “RecipientType -ne ‘MailUser” bit you see above.
This removes all Mail User recipient types from the GAL in question.
I have done exactly what is described above using the command below. But the Mailuser still appear in the Default GAL. All i want to hide the mail user from the Default Global Address List but show the in another Address list. I am trying this on Exchange 2010 SP1.
Set-GlobalAddressList “Default Global Address List” -RecipientFilter {(Alias -ne $null -and RecipientType -ne ‘MailUser’ -and (ObjectClass -eq ‘user’ -or ObjectClass -eq ‘Contact’ -or ObjectClass -eq ‘msExchSystemMailbox’ -or ObjectClass -eq ‘msExchDynamicDistributionList’ -or ObjectClass -eq ‘group’ -or ObjectClass -eq ‘publicFolder’))}
There is another post that suggested modifying GAL purportedSearch attribute. I have not yet tried this. I am not sure if this is safe?
Have anyone manage to archive what i am trying to do? Any help will be greatly appreciated.
Thanks
Isn’t there a GUI to work with or only command line? Use to be so easy to “hide” someone from the GAL and now you have to go to a command line and type in all that gibberish and hope you don’t wipe out everyone.
Hi Mary, you can still hide a single Mailbox User from the GAL using the GUI. You just go into Exchange Management Console, open the properties for that Mailbox User, and you’ll find the checkbox in there.
This article is about hiding *all* objects of the type “Mail User” (different to Mailbox User) from the GAL. In the article I describe what a “Mail User” is.
Hi Paul,
Asking you a favor, am a java guy, came across a need to provision a user in exchange with calendar only feature. That is the user uses external mail (mailuser) but needs calendar. My search around cmdlets to enable such a user did not turn up much, taking a chance here. Thank you.
V
Venu, calendars are part of the mailbox. You’ll just need to create a mailbox.
You can also bulk edit.
Just select all your contacts, choose properties, and check ‘hide from addresslist”
You could do that, but then you have to do that every time you create a new Mail User.
By modifying the query for the GAL you exclude all of them no matter when they are created.
Hi Paul,
If I run this ps1 cmdlet to remove ‘mailuser’ from the GAL, will this also remove it from the ‘All users’ list and a new custom Address List i’ve created for Mail Users??
Ideally, I want the mail users to appear only once in the Address Book – that should not be in the Default global address list and the All Users list, but in my newly created custom list.
thanks
It is Set-GlobalAddressList “Default Global Address List” so its only modifying the recipient scope of the “Default Global Address List” GAL object. The rest won’t be changed.