Windows 2000 Hot Fixes

  • Thread starter Thread starter JLUGIANO
  • Start date Start date
J

JLUGIANO

How can I get rid of those Hot Fixes which are sucking up
22 MB chunks of my hard drive?

Thanks
 
How can I get rid of those Hot Fixes which are sucking up
22 MB chunks of my hard drive?

Hi

Here is a VBScript that will remove the uninstall folder and Add/Remove
Programs
entry for all hotfixes that creates $ntuninstall... folders under the Windows
folders (that means that it will e.g. not remove uninstall information for
Internet Explorer and Outlook Express updates). The script will work on both
Win2k and WinXP.


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 unisntall 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 is now removed:" _
& vbCrLf & UCase(sDeleted)
Else
MsgBox "No updates found to remove the uninstall data for."
End If
 
Back
Top