CLI way of uninstalling a Windows update?
Solution 1
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.
Solution 2
You can use use wusa /uninstall /kb:{updateid}
http://www.sevenforums.com/tutorials/109213-windows-update-uninstall-console-level.html
Related videos on Youtube
Miguel Moll
Updated on September 18, 2022Comments
-
Miguel Moll over 1 year
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.
-
Admin over 11 yearsRelated: superuser.com/questions/270610/…. Not a direct duplicate, but one of the answers there applies.
-
Admin over 11 years@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.
-
Admin over 11 yearsThis answer uses
wuinstall
to remove an update with a known KB number: superuser.com/a/469511 -
Admin over 11 yearsHey @ThiagoM! I know
wuinstall
can do it. But I was hoping to not depend on a third-party app. I imaginewuinstall
is using something provided by the OS, no? -
Admin over 11 yearsWindows 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.
-
Admin over 11 yearsThere is Far Manager and my plugin Uninstall which allows to enumerate, filter, examine and uninstall programs. It also reveals uninstall command.
-
Admin over 11 years@radioact1ve wusa /uninstall /kb:{update ID} ... or did i miss something?....sevenforums.com/tutorials/…
-
Admin over 11 years@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...
-
Admin over 11 years@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.
-
Admin over 11 years@Moab Fair enough. That's what I thought. Looks like wusa for some updates and msiexec for the others.
-
Admin over 10 yearsThe Stack Overflow link is broken - the question has been deleted now.
-
-
Miguel Moll over 11 yearsYes this is what I've been using. Works great.
-
Peter Mortensen over 10 yearsWhat are the prerequisites for wusa? For instance, what versions of Windows?
-
a13ph almost 10 years@PeterMortensen - from XP 32bit up, according to whatisdll.com/wusa-exe-repair-free-download-windows-78xpvista and at least from Vista up according to support.microsoft.com/kb/934307 but that is probably because Microsoft stopped XP support