SOLVED: Command Line To Uninstall Software EXE’s or .MSI’s

There are five ready ways to uninstall software:

  1. Using the GUI – Right click on the START BUTTON > APPS AND FEATURES > click the app in question > UNINSTALL
  2. Using a build in uninstaller – Go to the folder where the product is installed, look for something like UNINSTALL.EXE then create a shortcut to it, edit the shortcut and add /? to the end.  Double click the shortcut to see the uninstallation switches
  3. WMIC – ‘Windows Management Interface Command’ can be used for .EXE’s  – see below
  4. MSIEXEC – ‘Microsoft Installer Executable’ can be used for programs that installed using a .MSI file
  5. PowerShell WMI Commands – The new way to uninstall!

We explore WMIC, MSIEXEC and POWERSHELL below:

Command Line to Uninstall a Program using WMIC

There are three easy things you need to do uninstall a program using WMIC.

  1. Open a CMD prompt running as an admin
  2. Figure out the EXACT name of the program by having WMIC produce a list:
    wmic product get name
  3. Use WMIC PRODUCT NAME command to remove the program you want
    wmic product where name="<PROGRAM NAME HERE>" call uninstall /nointeractive

If you do not use the /nointeractive switch, WMIC will prompt the user to confirm the uninstall, which likely defeats the purpose of the scripting the uninstall

Also note that wild cards can be used with WMIC but the command is slightly different:

wmic product where "name like '<PROGRAM NAME HERE>%%'" call uninstall

You also may want to clean up the installation folder, if it still exists using:

rd /s /q C:\Program Files\<PROGRAM FOLDER NAME HERE>

Command Line to Uninstall a Program using MSIEXEC

Programs installed with an .MSI are easy and has two choices:

Uninstall Using the Installation MSI

If you still have access to the .MSI installation file you can simply run:

msiexec /x <PROGRAM NAME HERE>.msi /q

Uninstall Using the App’s GUID

If you don’t have access to the .MSI installation file:

  1. Figure out what the GUID of the program is by opening REGEDIT and expanding:
    HKEY_LOCAL_MACHINE > SOFTWARE > Microsoft > Windows > CurrentVersion > Uninstall
  2. Either in a CMD window running as an ADMIN or a script running as an ADMIN
    msiexec /quiet /norestart /uninstall {<GUID>}
    like:
    msiexec /quiet /norestart /uninstall {7FCA6452-46F2-452F-A5A7-DAB7DE12D0E6}

How To Uninstall a Program using PowerShell

  1. You can use the first two steps in e WMIC method above to determine the exact program nae
  2. Use the following commands in a PowerShell running as an admin:
    $app = Get-WmiObject -Class Win32_Product -Filter "Name = '<PROGRAM NAME HERE>'"
    $app.Uninstall()

View Comments

  • Bravo for this page, I refer to it several times a month! Really very useful!

    I would also add the following command to be able to get the GUID of the installed apps.

    En powershell:

    $Installer = New-Object -ComObject WindowsInstaller.Installer; $InstallerProducts = $Installer.ProductsEx("", "", 7); $InstalledProducts = ForEach($Product in $InstallerProducts){[PSCustomObject]@{ProductCode = $Product. ProductCode(); LocalPackage = $Product.InstallProperty("LocalPackage"); VersionString = $Product.InstallProperty("VersionString"); ProductPath = $Product.InstallProperty("ProductName")}} $InstalledProducts

  • Funny enough I was looking up how to use this for Dell SupportAssist because the uninstall methods have changed

    • This is very cool thank you - so how does one do this via silent unattended noninteractive mode via command line?

      • Hi Martureo;

        If you are trying to push the uninstall remotely there are several methods. I like using PDQ Deploy (cheap and reliable), but you could add it as part of a log in script or use other tools.

Published by
Ian Matthews

This website uses cookies.