Download “” – Downloaded 1624 times – 2 KB

The Challenge

Microsoft has changed the way updates are being installed and uninstalled many times. This means that a common method can’t be used.

Windows XP and Windows 2003

  • Updates can be uninstalled from a hidden “uninstall” folder, located in the windows folder.  Windows 2008 R2 and Windows 7
  • A command line utility (wusa.exe) can uninstall the updates.

The solution

The solution contains one VBScript, this script is able to detect the local OS, and use one of the 2 methods above for uninstall.


  • The script does a check for the uninstall folder, and run the spuninst.exe
  • The script writes event log event (Source: WSH) in the local event log describing if it was found it not.
  • More logging can be enabled by the /log argument, and a text field will be created on the local machine


  • Script runs built-in the wusa.exe command.
  • The script does no check if the update is installed before trying to uninstall the update, since wusa.exe have no method for doing this.
  • Wusa.exe writes status messages to event log.
  • Wusa.exe supported /log argument, but it does not write text files, therefore a .evt file will be saved (if a path for another type of file is specified, it will automatically be changed to .evt to make the file usable.)

The Flowchart later in this document describes this in a more detailed way.

The script will end with success, no matter if the update exists on the machine or not. If it fails, something else is wrong (for example: bad command line in the ConfigMgr Program).


Known Issues

  • Windows 2008 (non R2) is Not Supported. It does not have the “old” uninstall folders in Windows folder, and “wusa.exe” utility does not support uninstallation.
  • Some updates cannot be uninstalled, even if we try to do it manually.
  • Other updates for Microsoft applications might not be possible to uninstall in this generic way
  • 3rd party application updates or service packs cannot be uninstalled.
  • Specific updates might use a non-standard installation method, which makes it impossible to uninstall (at least on XP/2003)

Using the script

Run the script with cscript.exe.

This is an example of the basic command line for running the script:


cscript.exe UninstallUpdates.vbs 976902


Syntax is


cscript.exe <scriptname> <kb number> <arguments>


this means you are able to use arguments for changing the behavior of the uninstall



Supported Arguments:
Argument Description
/passive This disables the /quiet argument, and makes a progressbar visible for the user.(requires the user to be able to interact with the program in ConfigMgr)
/norestart Disable automatic restart when using /quiet
/forcerestart Force a restart after uninstall, no matter if it is needed or not.
/warnrestart Warn user before restarting(requires the user to be able to interact with the program in ConfigMgr)
/log:”C:\temp\uninstall.log” Create a log file on the local machine.XP/2003: Text file

7/2K8R2: .evt eventlog file.

Notice there is no space between /log: and the path.

Allways surround the path with “ “ to make sure that it is parsed correctly.

To use argument in a command line

cscript.exe UninstallUpdates.vbs 976902 /norestart /log:”C:\KB976902-Uninstall.log”

Exit Codes

The script has a couple of custom exit codes.

You might experience other exit codes, if you have error in script, command line or similar.

Exit Code Description
10001 No arguments supplied, at least one argument (KB Number) is required!


a Thank you goes out to DFDS A/S