Solved

Deleting cookies and temp files

Posted on 2008-10-03
9
963 Views
Last Modified: 2012-05-05
Hi all I am trying to delete the cookies from all users that log into the server,
I found this script on this site but it didnt delete the cookies could you look at this and tell me what I did wrong .

Thanks




@ECHO OFF
SET SRC1=C:\Documents and Settings
SET SRC2=Local Settings\Temporary Internet Files\Content.IE6
SET SRC3=Local Settings\History
SET SRC4=Local Settings\Temp
SET SRC5=Recent
SET SRC6=Local Settings\cookies
FOR /D %%X IN ("%SRC1%\*") DO FOR  %%Y IN ("%%X\%SRC6%\*.lnk") DO DEL /F /S /Q "%%Y"
echo About to delete files from Internet Explorer "Temporary Internet files"
FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC2%\*.*") DO RMDIR /S /Q "%%Y"
echo About to delete files from Internet Explorer "History"
FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC3%\*.*") DO RMDIR /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR  %%Y IN ("%%X\%SRC3%\*.*") DO DEL /F /S /Q "%%Y"
echo About to delete files from "Local settings\temp"
FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC4%\*.*") DO RMDIR  /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR  %%Y IN ("%%X\%SRC4%\*.*") DO DEL /F /S /Q "%%Y"
echo About to delete files from "Recent" i.e. what appears in Start/Documents/My Documents
FOR /D %%X IN ("%SRC1%\*") DO FOR  %%Y IN ("%%X\%SRC5%\*.lnk") DO DEL /F /S /Q "%%Y"
echo About to delete files from "Windows\Temp"
cd /d %SystemRoot%\temp
del /F /Q *.*
@echo Y|RD /S ""
exit
0
Comment
Question by:Smaxon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 3

Expert Comment

by:JJLost
ID: 22634880
Are you using IE6 or IE7 ?

SET SRC2=Local Settings\Temporary Internet Files\Content.IE6
0
 

Author Comment

by:Smaxon
ID: 22635130
IE6
0
 

Author Comment

by:Smaxon
ID: 22635224
Its not deleting cookies but it deletes everthing else
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:JJLost
ID: 22635284
ok this took some tweaking but try it out
Batch File:

cd\
cd C:\Documents and Settings\%username%\Local Settings\
RMDIR /S /Q "Temporary Internet Files"
echo Deleting Files
echo File Deleted
mkdir "Temporary Internet Files"
exit


let me know
0
 

Author Comment

by:Smaxon
ID: 22635445
Thanks for that but it didnt work.
0
 
LVL 3

Expert Comment

by:JJLost
ID: 22635740
second try

del /q /s /f "C:\Documents and Settings\%username%\Local Settings\Temporary Internet Files\*.*"
0
 

Author Comment

by:Smaxon
ID: 22650752
Nope didnt work
0
 
LVL 3

Expert Comment

by:JJLost
ID: 22651844
Well, the script does what it is suppose to do however those cookies you see that are not being deleted is likely because they are locked (i.e you could likely delete them from the admin account).  The way I see it you can try two things:

1) Upgrade to Internet Explorer 7 and use the 'Empty Temporary Internet Files when Browser is closed" option

or..

2.) Run a disk cleanup at each log off
a) On the PC go Start > Run > Type  > REGEDIT /S cleanmgr.reg <
b) Next type > CLEANMGR /Sageset:1  < Check the boxes for what you want cleaned This sets your options for the following command
c) Create a .bat file with the line > CLEANMGR /sagerun:1 <
d) save it somewhere on the hard drive and add it to the shutdown scripts


To add a batch file to the shutdown scripts do the following:
1.) Start, Run, gpedit.msc
2.) Select Computer Configuration, Windows Settings, Scripts (Startup/Shutdown)
3.) Double Click Shutdown
4.) Click Add, and browse to the script.
5.) Click OK, and OK again.
6.) Close Group Policy and Restart Computer.
7.) The script should now be run on shutdown.

Let me know !
0
 
LVL 3

Accepted Solution

by:
JJLost earned 500 total points
ID: 22651888
EDIT:

I notice you said login so here is how to add a script to logon/logoff

1.) Start, Run, gpedit.msc
2.) Select USER Configuration, Windows Settings, Scripts (Login/Logoff)
3.) Double Click Logon or Logoff Whatever You Want*
4.) Click Add, and browse to the script.
5.) Click OK, and OK again.
6.) Close Group Policy and Restart Computer.
7.) The script should now be run on Logon or Logoff (Depending on what you selected).
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This article shows the method of using the Resultant Set of Policy Tool to locate Group Policy that applies a particular setting.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question