How to Uninstall an MSI package (with UI and silently) - 7 Methods to Use in the Enterprise Environment

Written by Horatiu Vladasel · August 18th, 2022

Uninstalling a package is as important as installing it, so it's crucial to handle it with care.

In this article, we will be going through how the uninstallation process works in an enterprise environment. Let’s start by looking at scenarios you could face where you need to uninstall an MSI package.

Uninstalling a specific MSI package in the enterprise environment - Scenarios

In an enterprise environment, there are situations that require uninstalling a specific package. Some of these scenarios include:

  • When an end-user moves to another department, some of the applications are not needed anymore, so they have to be removed from their device.
  • When an application is inactive and must be removed from all devices.
  • When we need to upgrade an application to its new version and the old version must be uninstalled to be replaced by the new version.

How to uninstall an MSI package?

As with installation, uninstallation of an application requires admin privileges. Within an enterprise environment, IT administrators are responsible for the management of the applications, which is usually done using application management tools such as SCCM (MEMCM) or Intune.

Here are some of the options you have when you need to uninstall an MSI package, either manually or from the command-line.

ImportantAll of these require administrative rights.

1. How to uninstall the MSI package if you have access to the original MSI

If you have access to the original MSI that was used to install the package, then you can simply right-click on it and select Uninstall.

Uninstall the MSI package if you have access to the original MSI

2. Uninstalling the MSI using the cached MSI

All the MSI packages installed on the device are cached in %SystemRoot%\Installer folder.

The easiest way to find out which one is your MSI package is to switch to the Details view, add Subject and Author columns to the view, and search for your product name and company/vendor name.

Find MSI Package by Product and Company Name

3. Using the AddRemoveProgram / Apps&Features interface entry

Most of the MSIs installed on the device have an entry in Program and Features (formerly known as AddRemovePrograms) which you can use to uninstall your package.

You can access the Program and Features in three ways:

1. By going to the Control Panel and clicking on Uninstall a program (make sure you selected View by Category)

Uninstall a program from Control Panel

2. By going to Control Panel and clicking on Programs and Features (here make sure you selected View by Small/Large icons)

Control Panel - Programs and Features

3. By using the appwiz.cpl run command

Appwiz.cpl Command

If you are on Windows 10, you can go to Windows Settings, then click on Apps and once you are there, you will see the full list of the installed apps.

Windows 10 - Apps and Features

4. Uninstalling an MSI from the command line using the msiexec.exe command

If you have access to the original MSI, then you can use the msiexec /x <path to the MSI file> command to uninstall your application.

NoteWindows Installer technology uses msiexec.exe for both the installation and uninstallation of MSI packages.

It is recommended to turn on logging and log all information, including verbose information. You can do that by adding /l*v <path to the log file> parameters to your uninstall command line.

msiexec /x <path to the MSI file> /l*v <path to the log file>

When working without a UI during the uninstallation process, you can use the /qn parameter.

msiexec /x <path to the MSI file> /qn  /l*v <path to the log file>

5. How to uninstall the MSI with msiexec using the ProductCode (also known as Product GUID)

If you know the ProductCode, you can use that to uninstall your application. The command line is similar to the one above. The only difference is that you use the ProductCode instead of the path to the MSI file.

This scenario is useful if you don’t have access to the MSI file but know the ProductCode.

msiexec /x <{ProductCode}>

The same msiexec parameters apply.

6. How to uninstall an MSI via PowerShell Start-Process cmdlet

You can use the Start-Process cmdlet to start the msiexec.exe process.

Then, use the -ArgumentList parameter to specify the parameters value to be used when the Start-Process cmdlet starts the msiexec.exe process.

Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/x <ProductCode> /qn /l*v <path to the log file" -Wait

7. How to uninstall an MSI via Powershell Get_WmiObject classes (Win32_Product)

To find the application that you want to uninstall, you can use the -Filter property. Then, to uninstall it, use the Get_WmiObject method of the Win32_Product class.

NoteTo use this method, you need Windows Management Instrumentation (WMI) so that the Windows Installer provider can retrieve all the installed products. This initiates a consistency check, which verifies and repairs the installation if needed.

$app = Get-WmiObject -Class Win32_Product -Filter "Name = '<ProductName>'"
$app.Uninstall()

How to silently uninstall an MSI package?

Windows Installer technology uses msiexec.exe for both the installation and uninstallation of MSI packages, and the Display options parameters are applicable to both.

The most common silent uninstall msiexec parameters are:

  • /quiet - no UI required (quiet mode)
  • /passive - shows only a progress bar (unattended mode)
  • /qb - shows only basic UI
  • /qb! - show only basic UI and hide Cancel button
  • /qn - no UI

To perform a silent uninstall of your MSI package, all you have to do is add the required parameter to the msiexec command.

For example:

 msiexec /x <{ProductCode}> /qn

Conclusion

As you can see, you have many options to choose from when it comes to uninstalling a Windows Installer MSI package.

There is no one-size-fits-all approach here, and it is up to you to decide which option is easiest and most convenient for you, depending on your needs.

Written by
See author's page
Horatiu Vladasel

Horatiu is a Software Packager/Sequencer with over 10 years experience, who has worked as a Software Packager at IBM and is currently offering software packaging services to companies such as BT or Nationwide.

Comments: