Unable to install SQL Server 2019 – SQL Install Error: The MOF compiler could not connect with the WMI server

The other day I was doing K2 5.5 installation on top of Windows Server 2019 and somehow that install beat all the records in terms of weird issues I run into, and even after re-provisioning server and starting from scratch I had to do resolve quite a few of them. One of those errors (not a directly K2 related one) was inability to install required version of SQL Server. Somehow I got a re-provisioned server with SQL 2014 and, as it is not supported by K2 5.5, I had to install SQL Server 2019 (5.5 supports 2016, 2017, 2019 and Azure SQL Database). But while installing SQL 2019 I run into the following blocking error:

SQL Install Error: The MOF compiler could not connect with the WMI server. This is either because of semantic error such as an incompatibility with existing WMI repository or an actual error such as the failure of WMI server to start.

Error message during installation of SQL Server 2019

Error message is a bit broad and it persisted even after removing all SQL related components from Programs and Features UI as well as deleting some remaining SQL related folders and registry keys. And I was trying to install only database engine services without any extra components and install was keep failing. That required to look into SQL installer logs where it was possible to see more specific/actionable error which looked approximately as follows:

Specified instance {SOME_GUID} via transform :InstID02.mst;:InstName02.mst is already installed. MSINEWINSTANCE requires a new instance that is not installed.

Error message from SQL Server 2019 Install Log

That basically means that some remnants of previous SQL installations are present and block installer from installing new/required versions of some components. And when you already deleted all SQL installer components from Programs and Features UI, you will need to query software list inventory using WMIC (Windows Management Instrumentation command-line) command:

WMIC PRODUCT Where "Caption like '%SQL%'" GET Caption, IdentifyingNumber

That will probably return bunch of SQL components with various GUID, as a minimum you will need to remove components with GUIDs mentioned in SQL installer logs, or if your goal is complete clean up of all SQL components all of them. As those are not visible in Programs and features you may delete them using the following command:

msiexec /x {SOME_GUID}

As in my case I had dozens of components returned and I wanted to do a complete clean up I created a little script for that:

SQL Server Components Clean Up script

With high probability removal of some of the components with the command shown above may fail and it that case you will need to remove them directly from registry looking for GUID value under the following keys:

HKEY_CLASSES_ROOT\Installer\Products\
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products

P.S. There is a blog post on sqlauthority.com which describes dealing with the same issue and helped me to resolve mine.

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *