Uninstall programs with wmic

This week I want to take a look at “Windows Management Instrumentation Command-Line” (aka WMIC).
I came across this tool (which even has some sort of subshell) by accident when I was looking for a convenient way to uninstall certain programs from the command line.
WMIC provides a way to interact with the powerful WMI (Windows Management Instrumentation) from the command prompt.
It offers a lot of features and commands to configure the computer and you can change almost all possible system parameters with it.

As I mentioned before I wanted to uninstall programs without having to trigger a “uninstall.exe” or look up this strange MSI codes from the registry.

Lets get hands on and start uninstalling programs
Fire up your command line interface and type

wmic product get name

(by only typing wmic you enter the subshell) and you should get a list of all programs installed on the computer.

Uninstalling a program is very easy and can be done by typing the following:

wmic product where name="XYZ" call uninstall

This command would query WMI and start the uninstall process for the program called XYZ.
Just make sure you use the exact name of the program (double check with the command “wmic product get name”)

If you want to use wildcards you can do this by running the following:

wmic product where "name like 'XYZ%%'" call uninstall

This command would trigger the uninstall process for all versions of the program XYZ installed on the computer.
As said before WMIC offers a lot more than just uninstalling programs – just have look :)