SOLVED: 6 Easy Ways To Uninstall Software Using Command Line

If you have software you need to uninstall via a script there are six easy ways to go about it:


1 – Uninstall Using The Software’s Own Tool

Many pieces of software come with their own custom uninstaller.  For instance if you want uninstall Dell SupportAssist, the command is:

C:\Program Files\Dell\SupportAssist\uninstaller.exe /arp

If you want to uninstall Office365 Pro Plus you could create an uninstall .XML using the Office Deployment Toolkit and then run:

\\<SERVER>\Office365ProPlus\setup.exe /uninstall ProPlus /config \\<SERVER>\office365$\uninstall-Office365ProPlus.xml


2 – Uninstall Using Microsoft Installer (MSI)

You can use the Microsoft Installer to uninstall most modern applications.  The command looks like:

msiexec.exe /x {<GUID>} /qn

This translates to use the Microsoft Installer to uninstall the software with a specific GUID, without prompting and without rebooting.  The question you likely have it, how do I find the GUID?  That is easy, just open the registry to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall .

For instance if you want to uninstall Office 2007 the command would be:

msiexec.exe /x {90120000-0011-0000-0000-0000000FF1CE} /qn


3 – Uninstall Using Windows Management Instrumentation Command Line (WMIC)

WMIC provides a simple command line for uninstallations:

WMIC product where name=”ProductName” call uninstall /nointeractive

command line uninstall wmicThe question is how to determine the exact “product name” and fortunately that is easy too.  Run:

WMIC product get name

You can use wildcards too, so if you wanted to uninstall Dell SupportAssist you could run:

WMIC product where name=”Dell SupportA%%” call uninstall

or

WMIC product where “name like ‘Dell SupportA%%'” call uninstall

You can suppress reboots by adding && shutdown /a (a = abort) to your script:

wmic product where name=”Dell SupportAssist” call uninstall /nointeractive | && (shutdown /a)

or if you are using PDQ to deploy this uninstallation:

(wmic product where name=”Dell SupportAssist” call uninstall /nointeractive) && (shutdown /a)

WMIC is very powerful with many options including the ability to run the command on remote machines.

For more details on WMIC, see THIS article and this Microsoft article that goes over all the WMIC switches


4 – PowerShell Uninstall

There are very complex PowerShell scripts to uninstall software but this is a very simple one I recently used to remove Dell SupportAssist:

Get-CimInstance -Classname Win32_Product | Where-Object Name -Match ‘Dell SupportAssist’ | Invoke-CimMethod -MethodName UnInstall

 


5 – Uninstall Using Third Party Tools

There are several uninstall tools that let you remove unwanted software including:


6 – Master Uninstallers

In addition to product specific uninstallers as detailed in option 1, most large (or old) software companies have developed free master uninstallers to remove ALL of their software.  These master uninstallers often provide command line options and do a much better job of uninstalling that the native uninstallers.  They typically search and destroy shortcuts, residual registry entries and files left on a PC from a normal uninstallation process.  You need to Google each product / company to see if they offer a master uninstaller but here are a few you to get you started:

Leave a Reply