Clearing AutoComplete and other Recipient Caches

This script allows you to clear one or more locations where recipient information is cached which might influence end user experience after migrating mailboxes.

 
 
 
 
 
4.4 Star
(9)
13,320 times
Add to favorites
Exchange
5/6/2020
E-mail Twitter del.icio.us Digg Facebook
  • Errors in script
    6 Posts | Last post November 15, 2019
    • Hi Michel. Running the script on Office365 online:
      
      DETTAGLIATO: Loading C:\Program Files\Microsoft\Exchange\Web Services\2.0\\Microsoft.Exchange.WebServices.dll
      DETTAGLIATO: Loaded Microsoft.Exchange.WebServices v15.0.0.0
      Processing mailbox test@test.it (test@test.it)
      DETTAGLIATO: Set to trust all certificates
      DETTAGLIATO: Using credentials admin@..........
      DETTAGLIATO: Looking up EWS URL using Autodiscover for test@test.it
      DETTAGLIATO: Using EWS on CAS https://outlook.office365.com/EWS/Exchange.asmx
      Eccezione durante la chiamata di "Bind" con "2" argomento/i: "The specified object was not found in the store., The process failed to get the correct properties."
      In C:\powershell\Clear-AutoComplete.ps1:201 car:9
      +         $InboxFolder= [Microsoft.Exchange.WebServices.Data.Folder]::B ...
      +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : ServiceResponseException
      
      Impossibile chiamare un metodo su un'espressione con valore null.
      In C:\powershell\Clear-AutoComplete.ps1:206 car:9
      +         $ItemSearchResults= $InboxFolder.FindItems( $ItemSearchFilter ...
      +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : InvokeMethodOnNull
      
      DETTAGLIATO: No AutoComplete Stream item found.
      DETTAGLIATO: No OWA AutoComplete item found.
      
      
      Why these errors?
      Thanks
    • Can't attach to the mailbox using provided credentials. Check authentication or use Impersonate
    • Hi Michel.
      Ok, we used Full Access authentication using O365 admin credentials and script runs with no errors:
      
      DETTAGLIATO: Set to trust all certificates
      DETTAGLIATO: Using credentials admin@domain.onmicrosoft.com
      DETTAGLIATO: Looking up EWS URL using Autodiscover for username@domain.com
      DETTAGLIATO: Using EWS on CAS https://outlook.office365.com/EWS/Exchange.asmx
      DETTAGLIATO: No AutoComplete Stream item found.
      DETTAGLIATO: No OWA AutoComplete item found.
      DETTAGLIATO: No Suggested Contacts folder found.
      DETTAGLIATO: No RecipientCache folder found.
      
      BUT, after script finishes we still see cached users from O365 apps. How can we check using MFCMAPI? I search for IPM.Configuration.OWA.AutocompleteCache but it does not exist for that user.
      Thanks
      
    • If it doesn't exist, the script did its work. However, the information might be cached in some places. Where are you looking; Outlook, OWA? You need to close it as otherwise you might be looking at cached information.
    • Hi Michel
      I'm looking in OWA, delve and sharepoint. Users are still present. Where could they be cached?
    • Be advised this only clears the autocomplete cache, not the people connections stored in Delve nor SharePoint.
  • Exception calling "Bind"
    4 Posts | Last post November 13, 2019
    • Greetings, hoping this fixes our Meeting request issue we're having. I tried to run:
      .\Clear-AutoComplete.ps1 -Identity USERNAME -Type Outlook -Verbose
      
      and got back:
      VERBOSE: Loading C:\Program Files\Microsoft\Exchange\Web Services\2.2\\Microsoft.Exchange.WebServices.dll
      VERBOSE: Loading module from path 'C:\Program Files\Microsoft\Exchange\Web
      Services\2.2\Microsoft.Exchange.WebServices.dll'.
      VERBOSE: Loaded Microsoft.Exchange.WebServices v15.0.0.0
      Processing mailbox USERNAME (USERNAME@domain.com)
      VERBOSE: Set to trust all certificates
      VERBOSE: Looking up EWS URL using Autodiscover for username@domain.com
      VERBOSE: Using EWS on CAS https://mail.domain.com/EWS/Exchange.asmx
      Exception calling "Bind" with "2" argument(s): "The specified object was not found in the store., The process failed
      to get the correct properties."
      At C:\scripts\Clear-AutoComplete.ps1:201 char:9
      +         $InboxFolder= [Microsoft.Exchange.WebServices.Data.Folder]::B ...
      +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : ServiceResponseException
      
      You cannot call a method on a null-valued expression.
      At C:\scripts\Clear-AutoComplete.ps1:206 char:9
      +         $ItemSearchResults= $InboxFolder.FindItems( $ItemSearchFilter ...
      +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : InvokeMethodOnNull
      
      VERBOSE: No AutoComplete Stream item found.
      
      
      Happen to have any suggestions?
    • Hi David. It seems we have the same problem. Did you try impersonation?
    • Yes, when I use the Impersonate flag I get "Can't access mailbox information store". I've tried using my admin account and a 2nd admin account, both are Exchange Admins, I've tried from a Exchange 2010 server, Exchange 2016 server, and Domain Controller, no luck, always the same results so I must be missing some critical piece.
    • Hi Michel
      I'm looking in OWA, delve and sharepoint. Users are still present. Where could they be cached?
      
      Thanks
  • OWA, the cache
    4 Posts | Last post September 18, 2019
    • Hello.
      After migration of the mail for exchange, there were left invalid addresses in the cache. I found your script on the Internet. I run it
      . \ Clear-AutoComplete.ps1 -Mailbox evsyukov.as@defo.ru -Credentials $ Credentials
      he thinks 20-30 seconds and gives out
      Processing mailbox evsyukov.as@defo.ru (evsyukov@defo.ru)
      But when I re-enter OWA, the cache appears again.
      I am sure that this cache is stored somewhere on the server. Since I open OWA at home, my cache is also present.
      Please tell me what to do? Which way to move?
    • Have you configured Autodiscover properly? If not (or to shortcut lookup times), you can use -Server <fqdn of your EWS endpoint>
    • Mishel hello.
      Thanks for your reply
      I specify the server name to connect. The script runs successfully, but autocomplete in OWA is not deleted.
      
    • Have you verified with MFCMAPI it's there?
  • Doesn't work on Exchange 2019
    2 Posts | Last post September 18, 2019
    • Hi
      I have tried this solution on Exchange 2019 but it didn't work.
      Is there any way I can find a solution for the same problem that works on exchange 2019? or is there a way to make this script work on EX2019?
      
      Thanks
    • What doesn't work? What message are you getting?
  • Can't access mailbox information store
    2 Posts | Last post June 17, 2019
    • Hi 
      we get following error: Can't access mailbox information store.
      script and dll files are running from the CAS server it self..
      any idea why it doesnt work?
      
      VERBOSE: Loading C:\temp\Clean-Autocomplete\Microsoft.Exchange.WebServices.dll
      VERBOSE: Loaded Microsoft.Exchange.WebServices v14.0.0.0
      Processing mailbox testusercal (testusercal@domainx.com)
      VERBOSE: Set to trust all certificates
      VERBOSE: Looking up EWS URL using Autodiscover for testusercal@domainx.com
      VERBOSE: Using EWS on CAS https://mail.sitename.com/EWS/Exchange.asmx
      C:\temp\Clean-Autocomplete\Clear-AutoComplete.ps1 : Can't access mailbox information store
      At line:1 char:25
      + .\Clear-AutoComplete.ps1 <<<<  -Mailbox testusercal -Type outlook -Verbose
          + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
          + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Clear-AutoComplete.ps1
      
      
      
      thanks in advance!
    • Usually permissions. Also, when running on an Exchange server, run it from a regular PowerShell session as running it from Exchange Management Shell won't work.
  • Specific entries
    2 Posts | Last post June 17, 2019
    • Hi Michel, thanks for the script, it's very useful.  I'm looking for a way to delete old group names from GAL in O365 envorinment, I don't need to clear the whole autocomplete list from all users, I just need to delete certain addresses from current users.
      
      Any chance to achieve this using your script?
      
      Thank you very much,
    • Current version is an all-or-nothing option. You require something to selectively remove entries?
  • no error on office365, but still not cached was removed
    2 Posts | Last post December 13, 2018
    • tried multiple time with no luck using bad domain
      
      VERBOSE: Loading C:\Program Files\Microsoft\Exchange\Web Services\2.2\\Microsoft.Exchange.WebServices.dll
      VERBOSE: Loading module from path 'C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll'.
      VERBOSE: Loaded Microsoft.Exchange.WebServices v15.0.0.0
      Processing mailbox user1@mydomain.com (user1@mydomain.com)
      VERBOSE: Set to trust all certificates
      VERBOSE: Using credentials admin@tenant.onmicrosoft.com
      VERBOSE: Using user1@mydomain.com for impersonation
      VERBOSE: Using Exchange Web Services URL https://outlook.office365.com/EWS/Exchange.asmx
      VERBOSE: No AutoComplete Stream item found.
      VERBOSE: No OWA AutoComplete item found.
      VERBOSE: No 'Suggested Contacts' folder found.
      VERBOSE: No RecipientCache folder found.
      
      
      I have found another script which can do one bad email address not using baddomain as search filter 
      
      https://gallery.technet.microsoft.com/office/How-to-reset-OWA-auto-5b2b3d3b
      
      can advise your script is more practical if deletion was affective 
      
      Thanks,
      Yousef
    • What you mean by 'baddomain'; you want option to strip specific domains from cached information? That is currently not an option.
  • Filter
    2 Posts | Last post August 28, 2018
    • Hey Michel, I noticed you stated you would add the ability to filter to the script, but there hasn't been any updates to it. I have some email addresses that I need to remove from the outlook autocomplete stream for about 70 mailboxes and this would be very helpful.
      
      Thanks,
    • Hi- no updates yet.
  • clear cache in other user mailbox
    2 Posts | Last post January 13, 2018
    • Hi, i need to clear cache on other user mailbox (this is not my mailbox).
      I try run your script and get this:
      verbose: No AutoComplete Stream item found.
      verbose: No OWA AutoComplete item found.
      And cache does not clearing. Where I've missing?
      
      
    • On-prem or 365? Using FA or Impersonation?
  • Is there a way to clear the autocomplete stream using powershell / EWS even though the client has caching enabled for his mailbox?
    2 Posts | Last post November 01, 2016
    • Many thanks for your script, works flawless for clients using OWA or EWS. Unfortunatelly, clearing the autocomplete stream for outlook 2013 clients who have caching enabled, doesn't work. Is there a way to be able to do this using the shell?
      
      Regards,
      J
    • 1) Outlook caches those autocomplete caches in %userprofile%\AppData\Local\Microsoft\Outlook\RoamCache. You might want to clear this, however, restarting Outlook should refresh this information anyway. Information here is read-only, for fast access by Outlook. The files for autocomplete are named Stream_AutoComple_* 
      2) Be advised when using multiple accounts in Outlook, you need to clear all those name caches. 
      
      To double-check: Just closed OL2016, cleared my RoamCache folder, and reset namecache on my accounts - no autocomplete popup when starting to type on the To field.
1 - 10 of 13 Items