Option Explicit Dim strEcho Dim strOSVirsion Dim intExitCode Dim strFilesResult Dim strScriptName Dim strCurentPath Dim strDriveLetter Dim strDirectory Dim objDocFolder Dim objUserFolder Dim objShell Dim objFileSystem Set objShell = CreateObject("WScript.Shell") Set objFileSystem = CreateObject("Scripting.FileSystemObject") '===Set Variables====================================================================================================================== strEcho = "On" strDriveLetter = "C" strScriptName = WScript.ScriptName strCurentPath = WScript.ScriptFullname strCurentPath = left(strCurentPath, instrrev(strCurentPath, "\")) 'Windows 9x On Error Resume Next strOSVirsion = objShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProductName") If Err.Number <> 0 Then 'Windows NT strOSVirsion = objShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName") End If '====================================================================================================================================== ChangeScriptHost "cscript" 'strDriveLetter = InputBox("Type new Owner and click OK", t, n) strDirectory = ":\Documents and Settings" If strEcho = "On" Then WScript.Echo(" ") If strEcho = "On" Then WScript.Echo("Removing " & strDriveLetter & strDirectory &"...") If objFileSystem.FolderExists(strDriveLetter & ":\Documents and Settings") Then Set objDocFolder = objFileSystem.GetFolder(strDriveLetter & ":\Documents and Settings") For Each objUserFolder in objDocFolder.SubFolders If objFileSystem.FolderExists(strDriveLetter & ":\Documents and Settings\" & objUserFolder.Name & "\Local Settings\Temporary Internet Files") Then If strEcho = "On" Then WScript.Echo("- Removing files for user: " & objUserFolder.Name) strFilesResult = objShell.Run ("cmd.exe /c del /Q/F/S """ & strDriveLetter & ":\Documents and Settings\" & objUserFolder.Name & "\Local Settings\Temporary Internet Files\*.*", 0, TRUE) strFilesResult = objShell.Run ("cmd.exe /c rmdir /Q/S """ & strDriveLetter & ":\Documents and Settings\" & objUserFolder.Name & "\Local Settings\Temporary Internet Files", 0, TRUE) End If Next End If If strEcho = "On" Then WScript.Echo(" ") If strEcho = "On" Then WScript.Echo("Removing History...") If objFileSystem.FolderExists(strDriveLetter & ":\Documents and Settings") Then Set objDocFolder = objFileSystem.GetFolder(strDriveLetter & ":\Documents and Settings") For Each objUserFolder in objDocFolder.SubFolders If objFileSystem.FolderExists(strDriveLetter & ":\Documents and Settings\" & objUserFolder.Name & "\Local Settings\History") Then If strEcho = "On" Then WScript.Echo("- Removing files for user: " & objUserFolder.Name) strFilesResult = objShell.Run ("cmd.exe /c del /Q/F/S """ & strDriveLetter & ":\Documents and Settings\" & objUserFolder.Name & "\Local Settings\History\*.*", 0, TRUE) End If Next End If If strEcho = "On" Then WScript.Echo(" ") If strEcho = "On" Then WScript.Echo("Removing Documents and Settings Temp Folder...") If objFileSystem.FolderExists(strDriveLetter & ":\Documents and Settings") Then Set objDocFolder = objFileSystem.GetFolder(strDriveLetter & ":\Documents and Settings") For Each objUserFolder in objDocFolder.SubFolders If objFileSystem.FolderExists(strDriveLetter & ":\Documents and Settings\" & objUserFolder.Name & "\Local Settings\Temp") Then If strEcho = "On" Then WScript.Echo("- Removing files for user: " & objUserFolder.Name) strFilesResult = objShell.Run ("cmd.exe /c del /Q/F/S """ & strDriveLetter & ":\Documents and Settings\" & objUserFolder.Name & "\Local Settings\Temp\*.*", 0, TRUE) strFilesResult = objShell.Run ("cmd.exe /c rmdir /Q/S """ & strDriveLetter & ":\Documents and Settings\" & objUserFolder.Name & "\Local Settings\Temp", 0, TRUE) strFilesResult = objShell.Run ("cmd.exe /c mkdir """ & strDriveLetter & ":\Documents and Settings\" & objUserFolder.Name & "\Local Settings\Temp", 0, TRUE) End If Next End If If strEcho = "On" Then WScript.Echo(" ") If strEcho = "On" Then WScript.Echo("Removing Recent Folder...") If objFileSystem.FolderExists(strDriveLetter & ":\Documents and Settings") Then Set objDocFolder = objFileSystem.GetFolder(strDriveLetter & ":\Documents and Settings") For Each objUserFolder in objDocFolder.SubFolders If objFileSystem.FolderExists(strDriveLetter & ":\Documents and Settings\" & objUserFolder.Name & "\Recent") Then If strEcho = "On" Then WScript.Echo("- Removing files for user: " & objUserFolder.Name) strFilesResult = objShell.Run ("cmd.exe /c del /Q/F/S """ & strDriveLetter & ":\Documents and Settings\" & objUserFolder.Name & "\Recent\*.*", 0, TRUE) strFilesResult = objShell.Run ("cmd.exe /c rmdir /Q/S """ & strDriveLetter & ":\Documents and Settings\" & objUserFolder.Name & "\Recent", 0, TRUE) strFilesResult = objShell.Run ("cmd.exe /c mkdir """ & strDriveLetter & ":\Documents and Settings\" & objUserFolder.Name & "\Recent", 0, TRUE) End If Next End If If strEcho = "On" Then WScript.Echo(" ") If strEcho = "On" Then WScript.Echo("Removing Windows Temp Folder...") If objFileSystem.FolderExists(strDriveLetter & ":\WINDOWS\Temp") Then Set objDocFolder = objFileSystem.GetFolder(strDriveLetter & ":\WINDOWS\Temp") strFilesResult = objShell.Run ("cmd.exe /c del /Q/F/S """ & strDriveLetter & ":\WINDOWS\Temp\*.*", 0, TRUE) End If If strEcho = "On" Then WScript.Echo(" ") If strEcho = "On" Then WScript.Echo("Removing Windows SoftwareDistribution Folder...") If objFileSystem.FolderExists(strDriveLetter & ":\WINDOWS\SoftwareDistribution") Then Set objDocFolder = objFileSystem.GetFolder(strDriveLetter & ":\WINDOWS\SoftwareDistribution") strFilesResult = objShell.Run ("cmd.exe /c del /Q/F/S """ & strDriveLetter & ":\WINDOWS\SoftwareDistribution\*.*", 0, TRUE) End If If strEcho = "On" Then WScript.Echo(" ") WScript.Sleep 10000 '10 sec '===Functions============================================================================================================================== Dim strScriptHost Dim strSHostResult Function ChangeScriptHost(strScriptHost) If InStr(LCase(wscript.fullname),strScriptHost) = 0 Then strSHostResult = objShell.Run("cscript.exe //NoLogo //H:" & strScriptHost & " //S", 0, TRUE) If strSHostResult = 1 Then strEcho = "Off" ElseIf strScriptHost = "wscript" Then objShell.Run strScriptHost & " " & strCurentPath & strScriptName, 0, False WScript.Quit Else objShell.Run strScriptHost & " " & strCurentPath & strScriptName, 8, False WScript.Quit End If End If End Function '===========================================================================================================================================