• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1333
  • Last Modified:

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
0
neilpage99
Asked:
neilpage99
  • 5
1 Solution
 
Kent DyerCommented:
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
0
 
neilpage99Author Commented:
I appreciate your reply kdyer, but I'm not sure what 'New-MailboxExportRequest' has to do with my request.
0
 
ontechCommented:
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.
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
neilpage99Author Commented:
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.
0
 
neilpage99Author Commented:
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?
0
 
neilpage99Author Commented:
Nothing...
I'm closing my question, thanks anyway.
0
 
neilpage99Author Commented:
No one gave me any tips, just repeated what I already did.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now