Posted on 周四 26 八月 2021

Ways to uninstall software on Windows



This article is reprinted from:

https://www.urtech.ca/2019/09/solved-command-line-to-uninstall-software-exes-or-msis/


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

  1. 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 uninstall1

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

  1. Either in a CMD window running as an ADMIN or a script running as an ADMIN

msiexec /quiet /norestart /uninstall {}

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 the WMIC method above to determine the exact program name

  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()