Solved

Deleting cookies and temp files

Posted on 2008-10-03
9
964 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Suggested Courses

635 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