How to troubleshoot orphaned and corrupted Office registry keys

%3CLINGO-SUB%20id%3D%22lingo-sub-2238206%22%20slang%3D%22en-US%22%3EHow%20to%20troubleshoot%20orphaned%20and%20corrupted%20Office%20registry%20keys%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2238206%22%20slang%3D%22en-US%22%3E%3CH2%20id%3D%22toc-hId--497322732%22%20id%3D%22toc-hId--497322733%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId-1990190101%22%20id%3D%22toc-hId-1990190100%22%3E%3CFONT%20size%3D%225%22%3EOverview%3A%20COM%20and%20.NET%20errors%3C%2FFONT%3E%3C%2FH2%3E%0A%3CP%3EIn%20some%20circumstances%2C%20devices%20that%20have%20completed%20an%20Office%20architecture%20migration%20(e.g.%2C%20moving%20from%2032-bit%20to%2064-bit)%20will%20have%20lingering%20registry%20keys%20that%20interfere%20with%20COM%20and%20.NET%20functionality.%20Generally%2C%20these%20issues%20occur%20when%20the%20COM%20or%20.NET%20client%20is%20running%20as%20a%2032-bit%20process.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20following%20PowerShell%20script%20is%20an%20example%20where%20you%20may%20encounter%20these%20errors.%20The%20following%20code%20is%20being%20executed%20using%20PowerShell%20(x86)%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24xl%20%3D%20New-Object%20-ComObject%20Excel.Application%0A%24xl.Visible%20%3D%20%24True%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20observed%20errors%20may%20include%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ETYPE_E_CANTLOADLIBRARY%3C%2FLI%3E%0A%3CLI%3ETYPE_E_LIBNOTREGISTERED%3C%2FLI%3E%0A%3CLI%3ETYPE_E_ELEMENTNOTFOUND%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH2%20id%3D%22toc-hId-182735638%22%20id%3D%22toc-hId-182735637%22%3E%3CFONT%20size%3D%225%22%3EUnderstanding%20how%20to%20detect%20the%20problem%3C%2FFONT%3E%3C%2FH2%3E%0A%3CP%3EDetection%20and%20eventual%20remediation%20requires%20scanning%20the%20registry%20for%20leftover%20or%20corrupted%20registry%20keys%20and%20deleting%20or%20correcting%20the%20identified%20keys.%20At%20this%20time%2C%20we%20have%20identified%20the%20following%20patterns%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CSTRONG%3E1.%20Orphaned%20references%20to%2032-bit%20providers%20of%20Office%20type%20libraries.%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3EThere%20may%20be%20keys%20that%20follow%20the%20pattern%20%5BHKEY_CLASSES_ROOT%5CWOW6432Node%5CTypeLib%5C%3CGUID%3E%5C1.9%5C0%5CWin32%5D%20and%20contain%20a%20default%20value%20that%20points%20to%20a%20non-existent%20Office%20executable%20in%20the%20Program%20Files%20(x86)%20path%2C%20such%20as%20C%3A%5CProgram%20Files%20(x86)%5CMicrosoft%20Office%5CRoot%5COffice16%5CEXCEL.EXE.%20These%20keys%20should%20have%20adjacent%20Win64%20keys%20that%20point%20to%20a%20correct%2064-bit%20Program%20Files%20location.%20The%20remediation%20is%20to%20delete%20the%20Win32%20key.%3C%2FGUID%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CSTRONG%3E2.%20Corrupted%20(empty)%20values%20for%20Office%2032-bit%20interface%20definitions.%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3EThere%20may%20be%20keys%20that%20follow%20the%20pattern%20%5BHKEY_CLASSES_ROOT%5CWOW6432Node%5CInterface%5C%3CGUID%3E%5CProxyStubClsid32%5D%20and%20have%20an%20empty%20default%20value.%20These%20keys%20should%20have%20corresponding%20keys%20outside%20of%20the%20WOW6432Node%2C%20following%20the%20pattern%20%5BHKEY_CLASSES_ROOT%5CInterface%5C%3CGUID%3E%5CProxyStubClsid32%5D%2C%20and%20with%20properly%20defined%20default%20values.%20The%20remediation%20is%20to%20delete%20the%20parent%20Interface%20key%20with%20a%20path%20having%20the%20pattern%20of%20%5BHKEY_CLASSES_ROOT%5CWOW6432Node%5CInterface%5C%3CGUID%3E%5D.%3C%2FGUID%3E%3C%2FGUID%3E%3C%2FGUID%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1624718825%22%20id%3D%22toc-hId--1624718826%22%3E%3CFONT%20size%3D%225%22%3EAvailable%20resources%20for%20remediation%3C%2FFONT%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EOrphaned%20references%20to%2032-bit%20providers%20of%20Office%20type%20libraries.%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EWe%20have%20developed%20two%20resources%20to%20help%20detect%20and%20remediate%20this%20first%20pattern.%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EStandalone%20PowerShell%20script%20-%20This%20script%20can%20be%20executed%20on%20affected%20devices%20to%20detect%20and%20remediate%20the%20orphaned%20references.%3C%2FLI%3E%0A%3CLI%3EConfiguration%20Baseline%20-%20The%20baseline%20is%20for%20use%20with%20Microsoft%20Endpoint%20Configuration%20Manager.%20Once%20imported%2C%20the%20baseline%20can%20be%20deployed%20in%20%22%3CEM%3EMonitor%3C%2FEM%3E%22%20mode%20first%20to%20help%20detect%20impacted%20devices%2C%20and%20then%20enabled%20for%20automatic%20remediation.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EBoth%20of%20these%20resources%20are%20available%20on%20GitHub%2C%20along%26nbsp%3B%20with%20additional%20instructions%20for%20deployment%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FOfficeDev%2FOffice-Typelib-Remediation%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EGitHub%3A%20Office%20TypeLib%20Remediation%3C%2FA%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ECorrupted%20(empty)%20values%20for%20Office%2032-bit%20interface%20definitions.%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ERemediation%20for%20the%20second%20pattern%20will%20be%20coming%20soon.%20Be%20sure%20to%20subscribe%20to%20the%20post%20for%20future%20updates.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-862794008%22%20id%3D%22toc-hId-862794007%22%3E%3CFONT%20size%3D%225%22%3EFuture%20Updates%3C%2FFONT%3E%3C%2FH2%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3EAt%20the%20time%20of%20writing%20this%20post%20we%20are%20continuing%20to%20monitor%20for%20reports%20of%20additional%20symptoms%2C%20and%20exploring%20opportunities%20for%20better%20integration.%20This%20article%20and%20the%20corresponding%20resources%20are%20provided%20as%20a%20first%20step%20in%20addressing%20these%20symptoms.%20We%20will%20continue%20to%20update%20this%20post%20and%20the%20provided%20resources%20as%20we%20identify%20new%20variables.%20%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

 

Overview: COM and .NET errors

In some circumstances, devices that have completed an Office architecture migration (e.g., moving from 32-bit to 64-bit) will have lingering registry keys that interfere with COM and .NET functionality. Generally, these issues occur when the COM or .NET client is running as a 32-bit process.

 

The following PowerShell script is an example where you may encounter these errors. The following code is being executed using PowerShell (x86):

 

 

$xl = New-Object -ComObject Excel.Application
$xl.Visible = $True

 

 

The observed errors may include:

  • TYPE_E_CANTLOADLIBRARY
  • TYPE_E_LIBNOTREGISTERED
  • TYPE_E_ELEMENTNOTFOUND

Understanding how to detect the problem

Detection and eventual remediation requires scanning the registry for leftover or corrupted registry keys and deleting or correcting the identified keys. At this time, we have identified the following patterns:

 

1. Orphaned references to 32-bit providers of Office type libraries.

There may be keys that follow the pattern [HKEY_CLASSES_ROOT\WOW6432Node\TypeLib\<GUID>\1.9\0\Win32] and contain a default value that points to a non-existent Office executable in the Program Files (x86) path, such as C:\Program Files (x86)\Microsoft Office\Root\Office16\EXCEL.EXE. These keys should have adjacent Win64 keys that point to a correct 64-bit Program Files location. The remediation is to delete the Win32 key.

 

2. Corrupted (empty) values for Office 32-bit interface definitions.

There may be keys that follow the pattern [HKEY_CLASSES_ROOT\WOW6432Node\Interface\<GUID>\ProxyStubClsid32] and have an empty default value. These keys should have corresponding keys outside of the WOW6432Node, following the pattern [HKEY_CLASSES_ROOT\Interface\<GUID>\ProxyStubClsid32], and with properly defined default values. The remediation is to delete the parent Interface key with a path having the pattern of [HKEY_CLASSES_ROOT\WOW6432Node\Interface\<GUID>].

 

Available resources for remediation

 

Orphaned references to 32-bit providers of Office type libraries.

We have developed two resources to help detect and remediate this first pattern. 

  • Standalone PowerShell script - This script can be executed on affected devices to detect and remediate the orphaned references.
  • Configuration Baseline - The baseline is for use with Microsoft Endpoint Configuration Manager. Once imported, the baseline can be deployed in "Monitor" mode first to help detect impacted devices, and then enabled for automatic remediation.

Both of these resources are available on GitHub, along  with additional instructions for deployment:

 

GitHub: Office TypeLib Remediation

 

Corrupted (empty) values for Office 32-bit interface definitions.

Remediation for the second pattern will be coming soon. Be sure to subscribe to the post for future updates.

 

Future Updates

At the time of writing this post we are continuing to monitor for reports of additional symptoms, and exploring opportunities for better integration. This article and the corresponding resources are provided as a first step in addressing these symptoms. We will continue to update this post and the provided resources as we identify new variables.

0 Replies