Re: Removing UninstallKB's from the Winnt directory
Jim in Cleveland wrote:
I'm trying to recoup some space off my C: drive. Looked in the Winnt
directory and I see a large number of $NtUnistallKB*folders. Can I remove
these without any repercussions? Things have been going smoothly so I don't
think I'm going to be rolling back any of the updates? Or, can I just move
these to another drive?
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
.
Relevant Pages
- Re: Which files can I delete?
... > uninstall information for Internet Explorer and Outlook Express ... > uninstall folder and the Add/Remove Programs entry. ... > the amount of disk space System Restore is allowed to occupy. ... > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ... (microsoft.public.windowsupdate) - Re: XP UPDATES
... Removing the updates will most likely not free up any memory, ... If you have a folder ... Remove Hotfix Backup files and the Add/Remove Programs Registry entries ... Microsoft MVP Scripting and WMI, ... (microsoft.public.windowsxp.security_admin) - Re: folder names
... $NtUninstallKBXXXXXX$ folder is present in C:\Windows. ... "Show Updates" box is checked. ... folders in Windows Explorer in my c drive in the Windows ... Those folders contain the files used to uninstall updates to ... (microsoft.public.windowsxp.basics) - Re: compressing updates already installed
... this will most likely uninstall important security updates. ... uninstall folder and the Add/Remove Programs entry. ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ... (microsoft.public.windowsupdate) - Re: compressing updates already installed
... this will most likely uninstall important security updates. ... uninstall folder and the Add/Remove Programs entry. ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ... (microsoft.public.windowsupdate) |
|