msiexec – Uninstall broken Installations
Sometimes you encounter some trouble regarding uninstalling broken programs and components.
In this case we can try to use the msiexec tool.
Provides the means to install, modify, and perform operations on Windows Installer from the command line.
|Specifies normal installation.
|Specifies administrative installation.
|Advertise the product to the current user.
|Advertise the product to all users.
|Specifies the language identifier used by the advertised package.
|Applies transform to the advertised package.
|Uninstalls the 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.