CLI way of uninstalling a Windows update?

9

5

Basically, what can be achieved by going to Control Panel > Uninstall a Program > View Installed Updates > Right Click Uninstall, but through the command line? Looking for a way that works across the Windows platform but if (and according to my reading, most likely) it's version dependent so be it.

Maybe something like:

C:\command /uninstall "Security Update for Windows 7 for x64-based Systems (KB2705219)"

Looks like using the KB would be great but wusa.exe works for the above example update but not for say "Security Update for Silverlight (KBXXXXXXXX)". Not much consistency.

I'm really surprised there isn't much documentation on this. How does an app like WUInstall do it?

Follow up question is how is that list of "View Installed Updates" populated? I've searched the registry like crazy hoping for an "UninstallString" or equivalent but only found references to the regular Add/Remove Programs list.

Miguel Moll

Posted 2012-09-12T01:43:38.070

Reputation: 91

Related: http://superuser.com/questions/270610/undoing-the-last-installed-windows-updates-via-command-line. Not a direct duplicate, but one of the answers there applies.

– Indrek – 2012-09-12T01:48:18.200

@Indrek thanks for the comment! Rolling back to a previous restore point is one way to handle it and I got that done, no problem. But it would be a pain to undo x amount of updates when only one of them needs to be removed. And as stated in the question, I'd really love to know how WUInstall does it. – Miguel Moll – 2012-09-12T02:01:24.527

This answer uses wuinstall to remove an update with a known KB number: http://superuser.com/a/469511

– paradd0x – 2012-09-12T02:38:21.993

Hey @ThiagoM! I know wuinstall can do it. But I was hoping to not depend on a third-party app. I imagine wuinstall is using something provided by the OS, no? – Miguel Moll – 2012-09-12T02:57:03.903

Windows updates can be uninstalled and enumerated with wusa, sounds like you already know about that. Application updates based on Windows Installer can be uninstalled with msiexec, but I don't know of any built-in command-line tool to enumerate them. I also don't know if there are any additional types of updates shown on the Installed Updates list. – Harry Johnston – 2012-09-12T04:00:57.707

There is Far Manager and my plugin Uninstall which allows to enumerate, filter, examine and uninstall programs. It also reveals uninstall command.

– Maximus – 2012-09-12T06:11:52.580

2

@radioact1ve wusa /uninstall /kb:{update ID} ... or did i miss something?....http://www.sevenforums.com/tutorials/109213-windows-update-uninstall-console-level.html

– Moab – 2012-09-12T21:34:45.947

@Moab You are right on! At least what I've read about wusa is that its Win7(Vista?) only. Hoping for an XP - 7 compatible way. I can dream... – Miguel Moll – 2012-09-13T01:00:47.537

@radioact1ve not possible, windows update changed dramatically starting with Vista. XP can be done from the command line but uses a completely different command sequence. – Moab – 2012-09-13T18:48:59.187

@Moab Fair enough. That's what I thought. Looks like wusa for some updates and msiexec for the others. – Miguel Moll – 2012-09-13T21:37:03.500

The Stack Overflow link is broken - the question has been deleted now. – Peter Mortensen – 2013-10-09T12:44:06.863

Answers

4

For Server 2003 and XP you could try:

C:\WINDOWS\$NtUninstallKB940157$\spuninst\spuninst.exe /quiet /norestart

Where the KB number would be the KB you would like to kill.

goatmale

Posted 2012-09-12T01:43:38.070

Reputation: 41

Yes this is what I've been using. Works great. – Miguel Moll – 2012-11-16T06:08:06.750

3

a13ph

Posted 2012-09-12T01:43:38.070

Reputation: 176

@PeterMortensen - from XP 32bit up, according to http://www.whatisdll.com/wusa-exe-repair-free-download-windows-78xpvista/ and at least from Vista up according to http://support.microsoft.com/kb/934307 but that is probably because Microsoft stopped XP support

– a13ph – 2014-06-25T11:52:43.097

What are the prerequisites for wusa? For instance, what versions of Windows? – Peter Mortensen – 2013-10-09T12:42:45.343

0

i find this very nice utility : https://bitbucket.org/kazenoco/windows-updates-uninstaller-utility/downloads/Windows%20Updates%20Uninstaller.exe


Windows Updates Uninstaller Utility This utility (scripted in AutoHotKey) allows you to batch uninstall the Windows Updates you want from your system. It does not uninstall Service Packs, so you need to uninstall those manually. Works in Windows XP, Vista, 7, 8 and 8.1. Installation There's no need to install anything, the executable is portable so you just need to download it and run it. The executable will create a temporal text file in its parent directory while it runs, and it will remove it automatically once it doesn't need it anymore.

user4860978

Posted 2012-09-12T01:43:38.070

Reputation: 1