I’ve been working on a PowerShell script that automates Microsoft Word to open all files in a SharePoint library, modify the header and other properties and then save it again. I ran the script against 4000 documents and everything went fine. But then I tried running it again (against the same files). Now Word began crashing randomly when opening files, with an error message The remote procedure call failed. (Exception from HRESULT: 0x800706BE) . The same could happen if I manually opened documents from SharePoint. Word just died silently.
Turns out it was a problem with the cache. After clearing and disabling the cache in Word, my script magically started working again! Edit you saving options:You may also want to clear you %TEMP% directory, just to be sure.