Link to home
Start Free TrialLog in
Avatar of neilpage99
neilpage99Flag for United States of America

asked on

Remove Mail Contacts and MailUsers from Exchange Global Address List

Active Directory version:  2008
Forest Functional Level:  2008
Domain Functional Level:  2008
Exchange version:  2010 SP1

We have a lot of "contacts" and "mailusers" in our Active Directory environment. To be clear, we are _not_ talking about AD users who have mailboxes - but rather AD objects _apart from_ users that have 'proxyaddresses' and 'aliases'.

What I want to do, is remove the 'contacts' and 'mailusers' from the main Global Address List, yet let them remain in the "All Contacts" address list.

I have followed this article:
http://exchangeserverpro.com/how-to-remove-mail-users-from-the-global-address-list

and this article:
http://www.infinitec.de/post/2005/02/How-to-get-the-Global-Address-List-programatically.aspx

But no luck - the 'contacts' and 'mailusers' still show up in the GAL. I have viewed from OWA and the list is the same as the OAB in Outlook: they both show the contacts and mailusers.

What is the trick to accomplish the removal of 'contacts' and 'mailusers' from _only_ the GAL - and still let them be listed in the "All Contacts" address list?

Thanks
Avatar of Kent Dyer
Kent Dyer
Flag of United States of America image

Have a look at this..

Look at the following page - http://technet.microsoft.com/en-us/library/ff607299.aspx

This does look like some pretty "gnarly" scripting dude!!  LOL!!

Have fun!

Kent
Avatar of neilpage99

ASKER

I appreciate your reply kdyer, but I'm not sure what 'New-MailboxExportRequest' has to do with my request.
think you are talking about Default GAL which contains all recipients in Exchange server.

So if you will see the Recipient Filter of this GAL using following command in EMS:

Get-GlobalAddressList "Default Global Address List" |FL *Filter

you will see a filter like:
{(Alias -ne $null -and (ObjectClass -eq 'user' -or ObjectClass -eq 'contact' -or ObjectClass -eq 'msExchSystemMailbox' -or ObjectClass -eq 'msExchDynamicDistributionList' -or ObjectClass -eq 'group' -or ObjectClass -eq 'publicFolder'))}

You can see it by default contains the Contacts too bcoz of the condition or ObjectClass -eq 'contact' .

So if you want that your default GAL exclude these contacts object then you will have to reset the Recipient Filter of your GAL like this:

Set-GlobalAddressList "Default Global Address List" -RecipientFilter {(Alias -ne $null -and (ObjectClass -eq 'user' -or ObjectClass -eq 'msExchSystemMailbox' -or ObjectClass -eq 'msExchDynamicDistributionList' -or ObjectClass -eq 'group' -or ObjectClass -eq 'publicFolder'))}

and then will have to create some other GAL for the contacts like this:

New-GlobalAddressList "Contacts Global Address List" -RecipientFilter {(Alias -ne $null -and ObjectClass -eq 'Contact')}

By default exchange contains an Address List with the name "All Contacts" for all contacts.

Also you will have to do some extra work to show a specific GAL to a set of users using user's Active Directory attribute "msExchQueryBaseDN".

Hope this is informative for you.
Thank you, ontech, but that's exactly what I did already. The articles above, which I listed in my first post, explain the same thing you suggested. I have done that, but the Default GAL still shows my contacts.

I also notice the AD Attribute:  "showinaddressbook" for each contact, it lists "Default Global Address List". If I remove that from the attribute, the contact won't be listed in the GAL any more. Does this setting overide the recipient filter on the GAL?  Is there a powershell script that can remove that item from the "showinaddressbook" attributes of _ALL_ the contacts at once?

I really appreciate your help.
I have created a brand new Global Address List called "Company Directory", using the recipient filter I wanted, which does _not_ include contacts or "mailusers". I used powershell to perform:
Get-Recipient -filter "AddressListMembership -eq '$((Get-GlobalAddressList "Company Directory").DistinguishedName)'"

Open in new window

...and it displays exactly what I want: no contacts or mailusers. It's been 36 hours and both Outlook and OWA _still_ show the contents of the original Default Global Address List. I checked, and the new "Company Directory" is set to $true for "IsDefaultGlobalAddressList". If I take one test contact and remove the "Default Global Address List" from his "showinaddressbook" attribute, he dissappears from the GAL which seems to prove that the old Default GAL is still being used even though it shouldn't be.

Anyone with any other ideas?
ASKER CERTIFIED SOLUTION
Avatar of neilpage99
neilpage99
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No one gave me any tips, just repeated what I already did.