System Administration Uncategorized

Windows: Uninstall Programs Via Command Line (Sudo Control Panel > Programs and Features > Uninstall)

I love when Windows command line tools are actually useful and friendly.  wmic  is a rare one that fits the bill.  I use the following command to uninstall programs silently (using Java as an example).

Find The Program Name

Run this command first to get the list of programs you can uninstall:

wmic product get name

Call The Uninstaller

Then, call the uninstaller in silent mode with this command:

wmic product where name="Java 7 Update 75" call uninstall /nointeractive
wmic product where name="Java 7 Update 75 (64-bit)" call uninstall /nointeractive

The name must match exactly and be kept in quotes.  This can be run from Altiris to automatically uninstall programs.

9 replies on “Windows: Uninstall Programs Via Command Line (Sudo Control Panel > Programs and Features > Uninstall)”

Hi, thanks for your uninstallation guide.
It works fine for me, exept that I still get a short prompt on each client after starting the script remotly – the /nointeractive option does not work there.

Any suggestions?

Ah, prompt was the wrong word – when I start the script, a cmd window opens on the remote pc showing (see attachment). After the uninstall is finished the cmd does close again automaticlly, but its disturbing for our users to see that…

One way around that is to run the batch script in minimized mode. I typically do this as shown below:

if not "%minimized%"=="" goto :minimized
set minimized=true
start /min cmd /C "%~dpnx0"
goto :EOF

wmic product where name="Java 8 Update 66" call uninstall /nointeractive

Doesn’t this depend on the registry containing a valid quiet uninstall string or an msiexec command that has standard options for a silent uninstall?

Good question. I’m not sure of the answer. I have used it for many years without issue. I have found as long as it appears under Programs and Features, this works.

Leave a Reply to Sascha Weber Cancel reply