Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cookies, Temp, Recent, Delete Routine - thread329-405235

Status
Not open for further replies.

Ickram

IS-IT--Management
Jun 24, 2008
1
GB
thread329-405235

LogOff Script to delete temp files.
VBscript

,,,Following script will verify the folder path then delete the files in the path.
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
C:\DOCUMENTS AND SETTINGS\USERNAME\COOKIES\*.*
C:\DOCUMENTS AND SETTINGS\USERNAME\RECENT\*.*
C:\DOCUMENTS AND SETTINGS\USERNAME\COOKIES\*.*
C:\DOCUMENTS AND SETTINGS\USERNAME\LOCAL SETTINGS\TEMP\*.*
C:\DOCUMENTS AND SETTINGS\USERNAME\LOCAL SETTINGS\TEMPORARY INTERNET FILE\*.*
C:\WIndows\TEMP\*.*
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
The user may not have rights to delete from C:\Windows\Temp
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Set wshNetwork = Wscript.CreateObject("Wscript.Network")
struser = wshNetwork.UserName

Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FolderExists("C:\DOCUMENTS AND SETTINGS\" & struser & "\RECENT") Then


objfso.DeleteFile "C:\DOCUMENTS AND SETTINGS\" & struser & "\RECENT\*.*", Force
Else
Wscript.Echo "Folder does not exist."
End If



If objFSO.FolderExists("C:\DOCUMENTS AND SETTINGS\" & struser & "\LOCAL SETTINGS\TEMP") Then


objfso.DeleteFile "C:\DOCUMENTS AND SETTINGS\" & struser & "\LOCAL SETTINGS\TEMP\*.*",Force
Else
Wscript.Echo "Folder does not exist."
End If



If objFSO.FolderExists("C:\DOCUMENTS AND SETTINGS\" & struser & "\LOCAL SETTINGS\TEMPORARY INTERNET FILES") Then


objfso.DeleteFile "C:\DOCUMENTS AND SETTINGS\" & struser & "\LOCAL SETTINGS\TEMPORARY INTERNET FILES\*.*",Force
Else
Wscript.Echo "Folder does not exist."
End If



If objFSO.FolderExists("C:\Documents and Settings\" & struser & "\Application Data\ICAClient\Cache") Then


objfso.DeleteFile "C:\Documents and Settings\" & struser & "\Application Data\ICAClient\Cache\*.*",Force
Else
Wscript.Echo "Folder does not exist."
End If


If objFSO.FolderExists("C:\Documents and Settings\" & struser & "\Application Data\Juniper Networks\EPCheck") Then


objfso.DeleteFile "C:\Documents and Settings\" & struser & "\Application Data\Juniper Networks\EPCheck\*.*",Force

End If

set wshNetwork = Nothing
set objFSO = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top