Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Remove Windows Update Uninstall Information, Sick of seeing $NtUninstall in Windows Folder, I am!
mastercomputers
post Aug 14 2008, 07:49 AM
Post #1


PESTICIDAL MANIAC
Group Icon

Group: Members
Posts: 626
Joined: 1-September 04
From: Auckland, New Zealand
Member No.: 27



Below is a script I created to remove those space taking $NtUninstall Folders from the Windows Directory as well as the entries in the Registry for them. It's not much space saving but at least it gets rid of the unnecessary scrolling that comes with it when looking in the Windows Folder.

Tested on Windows XP, Requires WScript and VBScript (which would be with most Windows OS)

$NtUninstall Folders contain the uninstall information required if you chose to remove a Windows Updated Component, I don't know anyone who needs to do this, and usually if you do, you would be required to remove it the second it's been installed because it should give you problems instantly. This script will only remove those that are present now, so if you do another Windows Update, you'll end up with newer folders so if you have problems with the new updates, least you have the option of going into Add/Remove to remove the new update. If you have no problems, you can re-use this script to remove them.

Save the script as RemoveWindowsUninstall.vbs in Notepad or any Text Editor of your choice (Not Word Processor Documents)

CODE
Option Explicit
Dim o, oShell, nConfirm
Set o = WScript.Application
o.Interactive = True
Set oShell = CreateObject("WScript.Shell")
nConfirm = oShell.Popup("Do you want to remove Windows Update Uninstall Files?", 0, "Remove Windows Update Uninstall Files", 4 + 32)
If nConfirm = 7 Then
    o.Quit 0
End If
Dim oFSO, sWinDir, oFolder, oDictionary, oSubFolder, sFolderName, sFolderPath, sUpdateName, sDeleted
Set oFSO = CreateObject("Scripting.FileSystemObject")
sWinDir = oFSO.GetSpecialFolder(0)
sDeleted = vbNullString
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, 12) = "$ntuninstall" And Mid(sFolderName, 13, 2) = "kb" Or Mid(sFolderName, 13, 2) = "q" Then
        sUpdateName = Mid(sFolderName, 13, Len(sFolderName) - 13)
        oDictionary.Add sUpdateName, sFolderPath
    End If
Next
For Each sUpdateName in oDictionary.Keys
    sDeleted = sDeleted & vbCrLF & sUpdateName
    sFolderPath = oDictionary.Item(sUpdateName)
On Error Resume Next
    oShell.RegDelete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & sUpdateName & "\"
On Error Goto 0
    oShell.Run "%ComSpec% /C RD /S /Q " & Chr(34) & sFolderPath & Chr(34), 0, True
Next
If Len(sDeleted) > 0 Then
    MsgBox "The uninstall data for the following updates are now removed:" & vbCrLf & UCase(sDeleted), vbOKOnly + vbInformation, "Files Removed"
    sDeleted = vbNullString
Else
    MsgBox "No Windows Update Folders found for removal", vbOKOnly + vbInformation, "Nothing To Do"
End If
o.Quit 0


Just run the program, and those pesky $NtUninstalls should be gone, I know there are other folders that could be removed too, but I'll look at doing that another time, the majority is made up of these $NtUninstalls.

I will be working on other scripts to remove Temporary Files, Cookies, Prefetch, Recent and any other nonsense I come across as I need to create a very basic clean up script that does all the tasks people usually need to do if they want to get some space back. So stay tune for that.

Cheers,


MC
Go to the top of the page
 
+Quote Post
toby
post Aug 14 2008, 11:09 AM
Post #2


Super Member
Group Icon

Group: Members
Posts: 555
Joined: 29-September 06
Member No.: 16,228



It's for rollbacks. Could you show some way of matching them up, so we can pick which to delete?
Go to the top of the page
 
+Quote Post
levimage
post Aug 14 2008, 10:02 PM
Post #3


Advanced Member
Group Icon

Group: [HOSTED]
Posts: 172
Joined: 1-October 07
From: United States
Member No.: 25,237



This seems cool. Maybe you could make some more scripts so when it comes to backing up the os or creating images, the images will be a lot smaller. Save space and make management easier. I always try to get rid of the pagefile.sys and the hibernation file. They take up a more space now days since computer/laptops use more memory.

Good job. tongue.gif
Go to the top of the page
 
+Quote Post
LegallyHigh
post Aug 14 2008, 10:19 PM
Post #4


Advanced Member
Group Icon

Group: [HOSTED]
Posts: 110
Joined: 12-April 08
Member No.: 29,760



Nice job man, I wish I knew how to script like that. The only language I have some knowledge of is HTML, and it can't be used for doing much besides creating websites.
Go to the top of the page
 
+Quote Post
wutske
post Aug 16 2008, 12:27 PM
Post #5


Way Out Of Control - You need a life :)
Group Icon

Group: [HOSTED]
Posts: 1,091
Joined: 2-August 05
From: Kapellen (Antwerp, Belgium)
Member No.: 7,585



Nice script, but I think there are thousands of other programs that do the same (and I personaly prefer to remove these folders manualy, IF I remove them smile.gif ).
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. How To Remove Bad Sectors Or Bad Clusters From HDD(18)
  2. What Is The Use Of Service Packs For Windows?(18)
  3. Msn Contacts Removal(11)
  4. How To Make Your Windows Look Like A Mac(24)
  5. A Note To All Illegal Windows Xp Owners(50)
  6. How Can I Delete Old Files In Windows Xp ?(22)
  7. MS Excel -- Automatic Update Of Data(3)
  8. 100 Reasons To Use Windows Vista(13)
  9. Windows Or Mac?(31)
  10. How To Install Ubuntu On Windows(5)
  11. Extremely Slow Hdd Operations On Windows Xp(9)
  12. Why I May Be Installing Windows Xp Sp3 Again(10)
  13. Image Problems With Windows 2000(10)
  14. Windows 7(12)
  15. Ea Releases Fifa 09!(3)
  1. Windows Black Edition(11)
  2. Windows Mobile 6.1 Games Folder(0)
  3. How To Make Both Windows Look Like Active At Same Time(9)
  4. Windows Xp, How To Re-enable Show All Possible Color(6)
  5. Remove Drm From Itunes Aac M4v M4p On Win And Mac(1)
  6. How To Change Your Windows User Environment Variables(5)
  7. Information_schema(9)
  8. Repairing Your Windows Environment(0)
  9. How To Enable User Login Security On Windows Vista(0)
  10. What Do You Guys Think Of Windows 7?(10)
  11. How To Improve Windows.(7)
  12. Why Still Windows But Ubuntu Linux(4)
  13. Windows 2000(4)


 



- Lo-Fi Version Time is now: 5th December 2008 - 11:11 AM