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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How TO Delete Internet Temporary Files using Group Policy or Script

Status
Not open for further replies.

Bhavin78

IS-IT--Management
Oct 26, 2004
320
How TO Delete Internet Temporary Files using Group Policy or Script?

I would prefer to use AD Group Policy, if thats not possible what's the VB script I can use to put in logoff script?
I tried below script but, it's not working

On Error Resume Next

Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj, Path

Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")


Dim tempiepath
tempiepath = "HKCU\Software\Microsoft\Windows\"

WSHShell.RegWrite tempiepath & "ShellNoRoam\MUICache\@inetcplc.dll,-4750","Empty Temporary Internet Files folder when browser is closed","REG_SZ"

WSHShell.RegWrite tempiepath & "CurrentVersion\Internet Settings\Cache\Persistent","0","REG_DWORD"
Set tempiepath = nothing
 
Code:
'==========================================================================
'
' NAME: EmptyTempInternetFilesonExit.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: [URL unfurl="true"]http://www.thespidersparlor.com[/URL]
' DATE  : 6/3/2004
'
' COMMENT: <comment>
'
'==========================================================================

Dim path
Set WSHShell = Wscript.CreateObject("WScript.Shell")

path = "HKCU\Software\Microsoft\Windows\"

WSHShell.RegWrite path & "ShellNoRoam\MUICache\@inetcplc.dll,-4750","Empty Temporary Internet Files folder when browser is closed","REG_SZ"

WSHShell.RegWrite path & "CurrentVersion\Internet Settings\Cache\Persistent","0","REG_DWORD"

I hope you find this post helpful.

Regards,

Mark
 
I tried samething but, it's not clearing anything from temp internet files.
This is VB script language or Windows scripting?
 
It is vbscript that runs using the Windows Script Host engine.

Save the file as a VBS file and double click. Note that the user running the script must have rights to the registry path specified in the registy. This is a PER USER setting, so it must be run by the user you want it to affect.

I hope you find this post helpful.

Regards,

Mark
 
I am doing excatly what you said, still does not work. All other part of my script work but this part does not work. I also tried to run this part of script by itself.

VBScript uses Windows script host engine for every thing or you can you something else too?
Is it possible to clear temp internet file from AD group policy?
 
I don't currently have access to a server to verify if there si a GPO setting for that, sorry.

I hope you find this post helpful.

Regards,

Mark
 
Please let me know if you find something.
I would also like to know about this? VBScript uses Windows script host engine for every thing or you can you something else too?

thanks for you time
 
vbscript can execute using wscript or cscript.

Internet Explorer can use vbscript in web pages, but I believe they call the underlaying wscript engine.

I hope you find this post helpful.

Regards,

Mark
 
why I cannot get your script to work? I copied that to notepad and saved as script.vbs and double clicked. I cheked in temp intertet files to make sure all files were deleted,but they are still there.

what line in your code below emptys the folder?
Dim path
Set WSHShell = Wscript.CreateObject("WScript.Shell")

path = "HKCU\Software\Microsoft\Windows\"

WSHShell.RegWrite path & "ShellNoRoam\MUICache\@inetcplc.dll,-4750","Empty Temporary Internet Files folder when browser is closed","REG_SZ"

WSHShell.RegWrite path & "CurrentVersion\Internet Settings\Cache\Persistent","0","REG_DWORD
 
You can use GP to remove temporary internet files, but you will need to have the settings in preference mode. On the GP, Under User Configuration->Windows Settings->Internet Explorer Maintenance (you need to right click, and put in Preference Mode)->Advanced. I can't remember which one after that, as my MMC on my work machine keeps dying. You will be able to "check-mark" the "Empty Temporary Internet Files when browser is closed".

 
This thread might give you a hand as well.

thread931-826016

The concept is the same as a server/regular machine....
 
Preference mode allows you to get to the "advanced" tab settings of IE. You would then be able to set settings such as:

Accessibility, Browsing, HTTP1.1 settings, Microsoft VM, Multimedia, Printing and Security.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top