
Last version: 1.3, November 15th, 2019.
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.
Read the full article over on ENow Solutions Engine blog.
Clean-AutoComplete
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>] [-Pattern <String[]>]
Where:
- 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.
- Pattern is the pattern of e-mail entries to remove from cache. Only works with OWA, SuggestedContacts and RecipientCache type clearances.
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
To remove the Autocomplete stream used by OWA on your Office 365 account, you can use:
Clear-AutoComplete.ps1 -Mailbox olrik@office365tenant.comΒ βCredentialsΒ (Get-Credential)Β βType OWA
Be advised that clearing the Outlook AutoComplete stream will only have effect for Outlook running in Online mode. Outlook caches this information as well in the OST file, leaving the options of running Outlook with the /CleanAutocompleteCache switch, or remove and let Outlook recreate the OST file. The temporaryΒ Stream_AutoComplete files*.dat files created under %USERPROFILE%\AppData\Local\Microsoft\Outlook\RoamCache are used by Outlook to speed things up.
Disabling Auto-Complete and Suggested Contacts
Alternatively, you can disable Auto-Complete, the equivalent of unchecking the Outlook option ‘Use Auto-Complete List to suggest names when typing in the To, Cc and Bcc line‘, by setting the following registry key:
Note: In the examples below, you need to modify the version number in the examples corresponding to the Outlook version you wish to apply these settings against. Use 16.0 as indicated for Outlook 2016, but change it to 15.0 for Outlook 2013, or 14.0 for Outlook 2010.
HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Preferences\
ShowAutoSug=0 (REG_DWORD)
To configure this setting using a Group Policy, use the following registry setting:
HKEY_CURRENT_USER\Software\Policies\Microsoft\office\16.0\Outlook\Preferences\ShowAutoSug=0 (REG_DWORD)
You can also disable Suggested Contacts folder, the equivalent of unchecking the Outlook option ‘Automatically create Outlook contacts for recipients that do not belong to an Outlook Address Book’, with the following registry key:
HKEY_CURRENT_USER\Software\Microsoft\office\16.0\Outlook\Contact\CreateContactsForOneOffs= 0 (REG_DWORD)
The related Group Policy setting is:
HKEY_CURRENT_USER\Software\Policies\Microsoft\office\16.0\Outlook\Contact\CreateContactsForOneOffs= 0 (REG_DWORD)
Feedback
Feedback is welcomed through the comments. If you got scripting suggestions or questions, do not hesitate using the contact form.
Download
You can download the script from my Technet Gallery here.
Revision History
See Technet Gallery page.
Like this:
Like Loading...