Wednesday, August 12, 2009

Deleting $NtUninstallKB folders in the Windows directory

In cleaning up space on my laptop, decided to look into whether it was safe to delete the $NTUninstallKB folders in the Windows
directories.

-----------------------------------------------------
Delete Microsoft Uninstall Update Files $NTUnistallKB
-----------------------------------------------------
There are many posts about this. These folders contain information that allows you to uninstall Microsoft updates.

If you are satisfied that an update is working on your computer and that you never want to remove that update, then you can delete
the folder for that update.

There will be a registry entry to list the update in Add/Remove programs. You can then go Add/Remove programs and click Remove. This
should give an error and then remove the entry from the registry.

CAUTION: DO NOT USE Add/Remove programs before you delete the folder or you will remove the actual update.

--------------------------------
Rename With @ to Make Deleteable
--------------------------------
If you are not sure, you can do what I do with all folders I am not sure about. I rename the folder, putting @date at the end. For
example, folder becomes folder@20090812.

My naming convention is that anything with an @ means it is deleteable at anytime.

The date tells me how long ago I made it deleteable. That way, after some time, if I never used the file, it is safe to delete.

--------------
Update Cleaner
--------------
You can buy Update Cleaner for $5 to delete the folder and remove the registry entry if you do not want to do it yourself.
www.pc-shareware.com/update.htm

--------
Ccleaner
--------
Crap Cleaner will also clean up these folders and registry entries. Ccleaner appears to delete them all or none, but not sure since
I did not try to use that feature. Update Cleaner lets you select which ones.

Ccleaner will analyze your computer for things to clean. This was useful. I had less than 1GB of the update files, so I did not
bother removing them.

Ccleaner cleans other things, including your registry.
www.ccleaner.com

----------------------------------------------------
VB Script to Delete Folder and Remove Registry Entry
----------------------------------------------------
There is an interesting entry from this page, with a script for deleting the folder and the entry in the registry for Add/Remove
programs.

www.eggheadcafe.com/forumarchives/windowsupdate/Oct2005/post25175268.asp
10/24/2005 5:21:05 PM Re: Removing UninstallKB's from the Winnt directory
Jim in Cleveland wrote:

Hi,

As long as you doesn't care about not being able to uninstall the

updates anymore, all the $ntuninstall... folders can be deleted.

Below is a VBScript (put it in a .vbs file) that I have written that

will remove the uninstall folder (and the Add/Remove Programs entry

if one exists) for all hotfixes that creates $ntuninstall... folders

under the Windows folder.

Note: This will not uninstall the update itself, only the

uninstall folder and the Add/Remove Programs entry.

'--------------------8<----------------------

Set oShell = CreateObject("WScript.Shell")

Set oFSO = CreateObject("Scripting.FileSystemObject")

sWinDir = oFSO.GetSpecialFolder(0)

Set oFolder = oFSO.GetFolder(sWinDir)

Set oDictionary = CreateObject("Scripting.Dictionary")

For Each oSubFolder In oFolder.SubFolders

sFolderName = LCase(oSubFolder.Name)

sFolderPath = LCase(oSubFolder.Path)

If Left(sFolderName, 13) = "$ntuninstallq" _

Or Left(sFolderName, 14) = "$ntuninstallkb" Then

' get the update name for the registry delete

sUpdateName = Mid(sFolderName, 13, Len(sFolderName) - 13)

' never delete folders/files while enumerating a file/folder collection

' adds them to a dictionary object for later handling instead

oDictionary.Add sUpdateName, sFolderPath

End If

Next

sDeleted = ""

For Each sUpdateName In oDictionary.Keys

sDeleted = sDeleted & vbCrLf & sUpdateName

sFolderPath = oDictionary.Item(sUpdateName)

On Error Resume Next

' remove entry in Add/Remove Programs

oShell.RegDelete "HKLM\SOFTWARE\Microsoft\Windows\" _

& "CurrentVersion\Uninstall\" & sUpdateName & "\"

On Error Goto 0

' delete the uninstall folder

oShell.Run "%Comspec% /C RD /S /Q " _

& Chr(34) & sFolderPath & Chr(34), 0, True

Next

If sDeleted <> "" Then

MsgBox "The uninstall data for the following updates are now removed:" _

& vbCrLf & UCase(sDeleted)

Else

MsgBox "No updates found to remove the uninstall data for."

End If

'--------------------8<----------------------

--

torgeir, Microsoft MVP Scripting, Porsgrunn Norway

Administration scripting examples and an ONLINE version of

the 1328 page Scripting Guide:

http://www.microsoft.com/technet/scriptcenter/default.mspx

No comments:

Post a Comment