This is a great script that helps you keep those patched boxes on your network running longer and faster. This script checks to see how old the Microsoft Windows Update Uninstall folders are and deletes them based on a parameter in the script. This reduces clutter on your PC and reduces one of the major disk hogs in a corporate environment. This script should be included in the Computers Group Policy so it has Administrative access to the PC so it can actually remove the files.
?Download cleanwu.vbs
Set oShell = CreateObject("Wscript.Shell") strWindows = oShell.ExpandEnvironmentStrings("%WINDIR%") On Error Resume Next Set fsoFolder = CreateObject("Scripting.FileSystemObject") Set objFolder = fsoFolder.GetFolder(strWindows) Set colSubfolders = objFolder.Subfolders For Each objSubfolder in colSubfolders If (DateDiff("D", objSubfolder.DateCreated, Date()) > 90) AND ((Left(objSubfolder.Name,3)) = "$Nt") then fsoFolder.DeleteFolder strWindows & "\" & objSubfolder.Name, TRUE End If Next |
RSS Feed
Twitter
March 31st, 2009
Wayne Zimmerman 
Posted in
Tags: