Windows Server 2008

Delete IE7 History From the Command Line

When cloning a computer running Windows XP, 2003, Vista or 2008, one of the tasks that you should perform before running SYSPREP is to delete the Internet Explorer 6 history, stored passwords, offline files and cookies. Same goes when preparing a computer for transfer to another user, or simply requiring that previous user data be deleted.

Through the usual IE GUI

One method of performing this task is by using the IE7 GUI.

Open Internet Explorer, and from the Tools menu, open Internet Options.

Sponsored Content

Maximize Value from Microsoft Defender

In this ebook, you’ll learn why Red Canary’s platform and expertise bring you the highest possible value from your Microsoft Defender for Endpoint investment, deployment, or migration.

Go to the General tab, and in the Browser History section, click on the Delete button.

In the Delete Browser History window, click one of the following buttons, based upon your requirements:

Temporary Internet Files > Delete files – To delete copies of web pages, images, and media that  are saved for faster viewing.

Cookies > Delete cookies – To delete cookies, which are files stored on your computer by websites to save preferences such as login information.

History > Delete history – To delete the history of the websites you have visited.

Form data > Delete forms – To delete all the saved information that you have typed into forms.

Passwords > Delete passwords – To delete all the passwords that are automatically filled in when you log on to a website you’ve previously visited.

Delete all – To delete all of the above in one operation.

By using a command

However, sometimes it is much easier to simply run a command line command or batch file to perform the same tasks. I use such a batch file and place it in one of my “special scripts” folder, where I store all my cool stuff. All I have to do is simply double-click on it, and bingo, history, passwords, cookies and offline files are deleted.

Here are the independent commands you can use. Go to Start > Run. Type CMD and press Enter. In the Command Prompt window, type (or copy and paste) the following commands, and press Enter:

Delete Temporary Internet Files

​RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8

Delete Cookies

​RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2

Delete History

​RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1

Delete Form Data

​RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16

Delete Stored Passwords

​RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32

Delete All

​RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255

Delete All with the “Also delete files and settings stored by add-ons” options selected

​RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351

Now it seems that the interesting bit is that you can combine the numbers to get 2 or more functions at the same time. For example, type:

​RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 9

This will delete the files (+8) and history (+1) in one step. You can incorporate this into a logoff script, and assign it to users by using Group Policy (GPO).

Creating a shortcut

You can create a shortcut and place it on your desktop or Quick Launch toolbar.

Right-click on an empty spot on your desktop, select New > Shortcut.

In the Create Shortcut window, paste one of the above commands.

Give it an appropriate name, and press Finish.

You can also change the shortcut icon by right-clicking on it and selecting Properties. Next press the Change Icon button.

You can use the following file to find some interesting icons for the shortcut:

​%SystemRoot%'System32'shell32.dll

Creating a batch file

You can also create a batch file that you can simply run by double-clicking on it. Save the following text as a .BAT file:

​@ECHO OFF
ECHO Deleting current user's Temporary Files, Cookies, History, Form Data and Stored Passwords
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255
ECHO Done!
PAUSE
CLS

Second example uses e different approach, but it’s also worth noting:

​@ECHO OFF
ECHO Cleaning Current User's Temp Folders
FOR /D %%G IN ("C:'Documents and Settings'*.*") DO DEL/S/Q/F "%%G'Cookies'*.*"
FOR /D %%G IN ("C:'Documents and Settings'*.*") DO DEL/S/Q/F "%%G'Local Settings'Temp'*.*"
FOR /D %%G IN ("C:'Documents and Settings'*.*") DO DEL/S/Q/F "%%G'Local Settings'History'*.*"
FOR /D %%G IN ("C:'Documents and Settings'*.*") DO DEL/S/Q/F "%%G'Local Settings'Temporary Internet Files'*.*"
ECHO Done!
PAUSE
CLS

Recent Windows Server 2008 Forum threads

Got a question? Post it on our Windows Server 2008 forums!

Related Topics:

External Sharing and Guest User Access in Microsoft 365 and Teams

This eBook will dive into policy considerations you need to make when creating and managing guest user access to your Teams network, as well as the different layers of guest access and the common challenges that accompany a more complicated Microsoft 365 infrastructure.

You will learn:

  • Who should be allowed to be invited as a guest?
  • What type of guests should be able to access files in SharePoint and OneDrive?
  • How should guests be offboarded?
  • How should you determine who has access to sensitive information in your environment?

Sponsored by: