SolutionBase: Safely removing the Windows XP Service Pack 2 Uninstall files

When you install Service Pack 2 on your Windows XP workstations, it creates an Uninstall directory to make it easy to remove SP2 if you have to. Unfortunately, this directory can take a lot of space. Here's how to free it up safely.

If you've installed Windows XP Service Pack 2 on top of an existing Windows XP installation and are satisfied with the way your system is behaving, you may want to consider removing the SP2 Uninstall files--especially if you want to keep your hard disk free from unnecessary clutter. The SP2 uninstall files take up anywhere from 300MB to 450MB of disk space. In fact, while you're at it you might also want to think about clearing out the Uninstall files for all the Hotfixes you installed before you installed SP2. (The SP2 installation procedure leaves the prior Hotfix Uninstall files in place in case you want to uninstall SP2 and then uninstall a particular Hotfix.) You can also remove any Hotfix Uninstall files for Hotfixes that you've installed after SP2 if you're satisfied with the way they work.

Even though the goal here is to remove the Uninstall files because you no longer feel that you need them and would prefer to have the extra hard disk space available for data and applications, you should make backup copies of the SP2 and other Hotfix Uninstall files. That way, should you ever decide to uninstall the files, you can restore the Uninstall files and then uninstall them

In this article I'll walk you through the entire procedure for backing up and removing SP2 and other Hotfix Uninstall files. As I do, I'll also show you how to remove the SP2 and Hotfix uninstall listings from the Add/Remove Programs tool.

Author's Note: Windows File Protection

Several folks with whom I've discussed this technique with mistakenly assumed that if you removed the SP2 Uninstall files, you would run into problems with Windows File Protection, which would no longer be able to do its job. However, that's not the case.

When you install SP2 on a Windows XP system, the installation procedure actually creates a separate folder in the Windows folder called ServicePackFiles\i386 in which the operating system keeps backup copies of all the main files replaced by SP2. This folder is then used by Windows File Protection in the event that a crucial system file needs to be replaced. In addition, the operating system uses the ServicePackFiles\i386 folder to store those files that are needed to install optional Windows components that aren't installed by default.

Locating and assessing the Uninstall files

The Windows XP operating system stores the SP2 and other Hotfix Uninstall files inside the C:\Windows folder as Hidden folders. As such you'll need to be sure that you've enabled the Show Hidden Files and Folders option on the View tab of the Folder Options dialog box.

Once you can view the Hidden folders in Windows Explorer, you'll be able to easily locate and identify the SP2 and other Hotfix Uninstall folders as their names all begin with a $ and end with a $. For example, the SP2 Uninstall files are stored in a folder called $NTServicePackUninstall$ and typical Hotfix Uninstall files are stored in folders named like $NTUninstallKB######, where KB###### refers to the Knowledge Base article ID number that describes the Hotfix.

At this point, you can investigate the folders and determine which ones you want to backup and then remove. While you're doing so, you can find out how much disk space each Uninstall folder is occupying. To do so, right-click on any folder, select the Properties command, and check out the Size On Disk section on the General tab.

Compiling a sorted list

If there are a lot of Hotfix folders in the Windows folder and you want to be able to quickly determine which Hotfixes were installed prior to installing SP2 and which Hotfixes were installed after installing SP2, you can quickly and easily compile a text file listing of all the Hotfix folders sorted by date with a simple command line. Here's how:

1.      Open a Command Prompt window

2.      Access the Windows directory by typing the command:
CD \Windows

3.      Compile the sorted list and send it to a text file by typing the command:
Dir /ahd /od $*.* > HotfixFolders.txt

4.      Load the file into Notepad for viewing and printing by typing the command:
Notepad HotfixFolders.txt

Now you can scan through the list, locate the $NTServicePackUninstall$ folder and quickly identify which Hotfixes were installed before and after SP2. This makes it a snap to determine which ones you want to backup and then remove.

Making backup copies

While the idea of trashing unnecessary clutter from your hard disk, on the surface sounds very appealing, when it comes right down to it and you're just about to perform the Delete operation, chances are that you'll get butterflies in your stomach and start second guessing the wisdom of such a move. As such, it's a good idea to make backup copies of the uninstall files. That way, should you ever decide that you do want to uninstall SP2 or any of the Hotfixes, you can still do so by first restoring the Uninstall files.

If you have a CD-RW or DVD-RW drive, you can easily make backup copies of your SP2 and Hotfix Uninstall folders by right-clicking on the folder(s) and selecting Send To | Driveletter where Driveletter is your CD-RW or DVD-RW drive. If you'll be saving backup copies on another hard disk or a network drive, you can use Copy and Paste or Drag and Drop.

Removing the Uninstall folders

As you may have surmised, removing the SP2 and Hotfix Uninstall folders is a simple matter of deleting the folders. However, some of the folders, like SP2, are quite large and can potentially cause the Recycle Bin to choke. As such, you'll want to bypass the Recycle Bin and permanently delete them. To do so, select a folder and then press and hold down [Shift] as you click the Delete button.

Eliminating the Add Or Remove Programs entries

The Add Or Remove Programs tool contains a check box at the top of the screen labeled Show Updates, that when selected, shows you all of the installed Hotfixes, thus allowing you to remove, or uninstall, the Hotfix. (SP2 shows up in the Add Or Remove Programs regardless of whether this check box is selected.)

Well, these entries remain in the Add Or Remove Programs tool after you've deleted the SP2 and Hotfix Uninstall folders. As such you'll want to eliminate them from the Add Or Remove Programs tool. Fortunately, doing so is a simple procedure.

To begin, access the Add Or Remove Programs tool and select the Show Updates check box at the top of the Add Or Remove Programs window. Now, scroll through the list and select the entry titled Windows XP Service Pack 2. When the entry expands, click the Remove button. When you do you'll see an Uninstaller Error dialog box like the one shown in Figure A.

Figure A:

Once Windows discovers that the Uninstall files are missing, it prompts you to remove the entry in Add Or Remove Programs.

As you can see, not only does this dialog box alert you to the fact that the operating system cannot remove Windows XP Service Pack 2, but it also prompt you to remove the entry from the Add Or Remove Programs tool's list. To do so, simply click Yes.

To remove the Hotfix entries from the Add Or Remove Programs tool, scroll down to the Windows XP Software Updates section, select a Hotfix entry that you want to eliminate, click the Remove button, and follow the steps outlined earlier

Undoing the procedure

If at a later date you decide that you want to uninstall SP2 or a particular Hotfix, all you have to do is restore the Uninstall folder to the Windows folder. Once you do so, just open the Uninstall folder, open the Spuninst folder, and double-click the Spuninst.exe file to launch the removal procedure.