I think that almost every Exchange admin can concur with me that the Outlook autocomplete cache is one of those things you love but at the same time also
hate.
Users mostly love this function, except when it fails.Luckily since Outlook 2010 things got a little better and we got rid of the dreaded nk2 files.Outlook 2010 now includes a folder named "Suggested Contacts", all users you send an email to and that don't already have an contact object are saved in this suggested contacts folder.A lot of people thought this folder is also the source for the autocomplete cache, which would make it somewhat easy to manage,
I wish the solution was that easy.Badly enough separate from the suggested contacts, outlook still maintains a cache for the autocomplete function.
Let us say you run in to the following situation:
John works for company A and is a popular contact for almost everyone in your organization.Now John quit his job at Company A and moved to Company B.Luckily John maintains your company as customer, but his email address is now changed from companyA.com to companyB.comSince you don't want to do any business with Company A anymore, you want to make sure none of your users accidentally mail to his old address.Now this is where the real fun starts, cause almost all of your 1000 users have mailed at least once with John.Resulting in the fact that every user has John most probably listed in their autocomplete cache.
I have run into sort like situations multiple times with several customers, which is always a pain.And of course this blog post is the result of one of those issues once again.
I knew that with the Suggested contacts we could do more than previously, but still never spent time on it before.But today
I thought lets nail this now and forever!!
Ok let's start of that things are different for every combination of outlook and exchange.
I explain the procedure for Exchange 2010 SP1+ in combination with Outlook 2010.At first we want to get rid of all contact objects that contain
[email protected] do this we need to be assigned to the RBAC role "Mailbox Import Export", which can be done through the Exchange Control panel.In my test environment
I assigned this role to the Organization admins, but in real life you might want to add it to a custom role.
Open the Exchange control panel by logging in to the ecp url, in my case https://ITFEX.itf.local/ECP, and make sure you selected your organization as management scope.Browse to Roles & Auditing, and open the properties for the organization management role group.click on the Add button to add a new role to the Organization Management role group, select the Mailbox Import Export role and click on add and OK to add it to the role.
Once you have assigned that role to your account you can open the Exchange Management Shell and execute the following command:
Get-mailbox –resultsize unlimited | search-mailbox –targetmailbox "your.account" –targetfolder searchanddelete –loglevel full –logonly –searchquery "kind:contact AND
[email protected]"
This command will create a list with all mailboxes and any contacts that were found with an email address that contains
[email protected], this list is then posted in the mailbox you specified at your.account in the folder searchanddelete.Now examine the report that was created and posted in the mailbox to see if it matches what you think it should match.My results looked like this:
When you're confident that the search includes all references and no false positives you can execute almost the same command, but this time with an delete action instead of the logonly.
Get-mailbox –resultsize unlimited | search-mailbox –targetmailbox "your.account" –targetfolder searchanddelete –loglevel full –DeleteContent –searchquery "kind:contact AND
[email protected]"
Now most people would think this would remove the contact object from the suggested contacts, resulting in a removal from the autocomplete list.Sad but not true, to clean up the autocomplete list start Outlook with the command: "outlook /cleanautocompletecache"
This will result in an empty cache, but luckily this is rebuild based on the suggested contacts, which now doesn't include the
[email protected] contact anymore.