Sometimes you encounter some trouble regarding uninstalling broken programs and components.

In this case we can try to use the msiexec tool.

msiexec.exe
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/msiexec


Provides the means to install, modify, and perform operations on Windows Installer from the command line.

msiexec.exe [/i][/a][/j{u|m|/g|/t}][/x]

ParameterDescription
/iSpecifies normal installation.
/aSpecifies administrative installation.
/juAdvertise the product to the current user.
/jmAdvertise the product to all users.
/j/gSpecifies the language identifier used by the advertised package.
/j/tApplies transform to the advertised package.
/xUninstalls the package.
<path_to_package>Specifies the location and name of the installation package file.


To install a package named example.msi from the C: drive, using a normal installation process, type:

msiexec.exe /i "C:example.msi"



Uninstall a package

To uninstall a package with the /x flag, we first need to determine the Globally Unique Identifier (GUID) of the package.

There are several options to find the GUID of installed programs and components, one for example is to look in the registry which is not really comfortable.

An easy way to find the GUID of an installed program or componet is to use the PowerShell Cmdlet Get-WmiObject.


Get-WmiObject Win32_Product -Filter "Name LIKE '%SQL Server Management%'"


In this example, there is a broken intallation of the SQL Server Management Studio. The normal way using Program and Features to deinstall it, is not an option, because it is not showing up there.

So we can determine the GUID of the individual components from the SQL Server Management Studio with the command above.


Now I can use these GUIDs to uninstall the packages with the msiexec.exe tool and the /x flag.



Links

msiexec
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/msiexec