Anyone who has participated in migrations or transitions to Exchange has most likely encountered or has had to work around potential issues caused by the nickname cache. A “cache,” also known by its file extension, NK2 in older Outlook clients, is a convenience feature in Outlook and Outlook WebApp (OWA) which lets users pick recipients from a list of frequently-used recipients. This list is displayed when the end user types in the first few letters.
The potential issue revolves around end users using those lists to send messages, as the list contains cached recipient information. Because this information is static, it may become invalid at some point. Thus, when users pick recipients when sending messages, they may be sending messages to non-existent recipients or invalid e-mail addresses, which create issues like non-delivery of e-mail.
Using the script mentioned in the article, which can be used to clear cached recipient information, is straightforward. It requires Exchange 2010 or later and Exchange Web Services Managed API 1.2 (or later) which you can download here. Alternatively, you can copy the Microsoft.Exchange.WebServices.DLL with the script as it will also look for it in the current folder.
The script Clean-AutoComplete.ps1 has the following syntax:
Clear-AutoComplete.ps1 [-Mailbox] <String> [-Server <String>] [-Impersonation] [-Credentials <PSCredential>] [-Type <Array>]
- Mailbox is the name or e-mail address of the mailbox.
- Server is the name of the Client Access Server to access for Exchange Web Services. When omitted, the script will use AutoDiscover.
- Switch Impersonation specifies if impersonation will be used for mailbox access, otherwise the current user context will be used.
- Credentials specifies the user credentials to use.
- Type specifies what cached recipient information to clear. Options are Outlook (Outlook AutoComplete stream), OWA (OWA Autocomplete stream), SuggestedContacts, RecipientCache or All. Default is Outlook,OWA.
So for example, suppose you want to clear the Autocomplete stream used by Outlook on a mailbox, you can use:
Clear-AutoComplete.ps1 -Mailbox Olrik -Type Outlook -Verbose
Clear-AutoComplete.ps1 -Mailbox firstname.lastname@example.org –Credentials (Get-Credential) –Type OWA
Feedback is welcomed through the comments. If you got scripting suggestions or questions, do not hesitate using the contact form.
You can download the script from my Technet Gallery here.
See Technet Gallery page.