Curious case of DW20SharedAMD64.MSI and Exchange installation failures

In my last post, I talked about one of the issues where dw20sharedamd64.msi hampered Exchange installation.
Not all issues involving this MSI are as straightforward as the one mentioned in that post.

I happened to work on, what could probably be my longest running Exchange installation case involving the very interesting dw20sharedamd64.msi and was fortunate (!) enough to encounter all possible flavors of this error message.

The issue started when we attempted to patch the server with Exchange 2007 Service Pack 3 which failed. When I started working, Exchange was already uninstalled and every attempt of installing Exchange was failing with the following error:

ErrorRecord: Microsoft.Exchange.Configuration.Tasks.TaskException: Installing product C:\Program Files\Microsoft\Exchange Server\bin\dw20sharedamd64.msi failed. This action is only valid for products that are currently installed. Error code is 1605. ---> System.ComponentModel.Win32Exception: This action is only valid for products that are currently installed

DW20SharedAMD64.MSI is nothing but Microsoft Application Error Reporting or Dr. Watson, better known by the installer as 000021599B0090400100000000F01FEC.It was clearly pointing us to a broken installation of Microsoft Application Error Reporting.

When installer logs (voicewarmup!) did not help much, we went back to basics and collected a Process Monitor log when trying to install the MSI.

1:55:35.0521838 PM msiexec.exe 6208 RegOpenKey HKCR\Installer\Products\000021599B0090400100000000F01FEC NAME NOT FOUND Desired Access: Read

We could get this key from another machine, but in this case, I was able to find another copy of the key at the following location:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\000021599B0090400100000000F01FEC

Its a simple trick of exporting this key and replacing HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion with HKEY_CLASSES_ROOT and removing UserData\S-1-5-18\.
In any case, point is to get that key back.

Once we got HKCR\Installer\Products\000021599B0090400100000000F01FEC back, we got the following error while installing:

Installing product C:\Program Files\Microsoft\Exchange Server\bin\dw20sharedamd64.msi failed. Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, Use add/remove programs on control panel

The error was much clearer this time around. Using Installer Cleanup we were able to find a product version 12.0.6015.5000. (I could use Add/Remove Programs as well.)
Once the product was removed we went past "Another version of this product is already installed" error, only to get the third error:

Installing product C:\Program Files\Microsoft\bin\dw20sharedamd64.msi failed. Fatal error during installation. Error code is 1603. Last error reported by the MSI package is 'Could not open key: UNKNOWN\Components\7ABFE44842C12B390AF18C3B9B1A1EE8\000021599B0090400100000000F01FEC. Verify that you have sufficient access to that key, or contact your support personnel.'.
Fatal error during installation

This is as simple as it can get! Adding permissions to the registry key under scanner and we were able to install Exchange and subsequent service packs just fine!