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/scr...r/default.mspx