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

Temp Internet Files cleanup on Terminal Users 3

Status
Not open for further replies.

TechDaddy123

IS-IT--Management
Apr 18, 2002
30
0
0
US
My users profiles are growing in size pretty quickly. Anyone have a quick fix for flushing all the temporary files from all my users remote desktop profiles? I can't depend on them to go and delete their files manually at the IE options box.

Thanks in advance!
 
You could put this script in the group policy as a logoff script and you should be good:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")

For Each objComputer in colComputer

Next

Const DeleteReadOnly = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile("C:\Documents and Settings\" & username & "\Local Settings\Temporary Internet files\*.*"), DeleteReadOnly

Let me know if you have problems.
 
TechDaddy,
I am running into problems myself, so hold off before trying this script.
 
TechDaddy,
Is the TS located on your network (domain member) or do people logon using a local account?
 
TechDaddy,
This one will work for you on a local based machine (logon to the TS using a local type account):

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
Username = objComputer.Username
UserPOS = InStrrev(Username,"\")
Username = Mid(username,UserPOS+1,Len(username))
Next
Const DeleteReadOnly = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile("C:\Documents and Settings\" & Username & "\Local Settings\Temporary Internet files\*.*"), DeleteReadOnly

This one will work for network type accounts:

set oNetwork = CreateObject("WScript.Network")
Username = oNetwork.Username
Const DeleteReadOnly = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile("C:\Documents and Settings\" & username & "\Local Settings\Temporary Internet files\*.*"), DeleteReadOnly

Got any problems, shot them back.
 
Wow, that's a much better answer that I'd even hoped for. My terminal server is a domain member.

I'm going to give this a try right away.
 
Should this be saved as a .bat or .wsh file?

Thanks for your help
 
Save it as a .vbs, and that should do it. If you wish, you can put this in your group policy (as I did) to make sure that machines in your group also get this stuff cleaned out.
 
Techdaddy123,

I found another area in which you can play with. If you notice under IE6, tools, internet options, advanced, towards the bottom under security, there is a option to "Empty temporary internet files when browser is closed". I found you can go to you Group Policy, and under user configuration, Windows settings, internet explorer maintenance, advanced (you may need to right click and select preference mode [it could say you have to reset your browser first]), internet settings, advanced settings, place a check mark in the "delete saved pages when browser closed" box and close it out. Should work for you.
 
You ready for this one? Found another way with a script. This one will set the browser to clean the TIF's on closing the browser. It changes the .reg setting so be careful....

Dim WSHShell, RegLocate, RegLocate1
Set WSHShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next
RegLocate = "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Persistent"
' Take great care with the line above
' Note the space between \Internet and Settings
WSHShell.RegWrite RegLocate,"0","REG_DWORD"

WScript.Quit ' Tells the script to stop and exit.

Change it to a .vbs, and put it in the GP and you should be a lot happier. I know I am, although this has been driving me nuts for a little while.
 
Thanks! One of these methods ought to stomp out the problem.
 
The default behaviour if you setup a TS roaming profile for the users is not to include the TIF directory as part of the profile::

The GPO setting:
exclude directories in roaming profiles (userconfig>admintemplates>system>userprofiles)
================================================
explaination:

Lets you add to the list of folders excluded from the user's roaming profile.

This setting lets you exclude folders that are normally included in the user's profile. As a result, these folders do not need to be stored by the network server on which the profile resides and do not follow users to other computers.

By default, the History, Local Settings, Temp, and Temporary Internet Files folders are excluded from the user's roaming profile.

If you enable this setting, you can exclude additional folders.

If you disable this setting or do not configure it, only the default folders are excluded.

Note: You cannot use this setting to include the default folders in a roaming user profile.
=========================================================

Therefore if you simply setup roaming profiles then disable caching of local roaming profiles then the TIFs will never accumalate in the 1st place.
There is nothing to stop you from having the profiles on the terminal server.

Hope this makes sense.
#


 
However, not all companies are able to deploy roaming profiles in a domain setting. I wish I could, but due to the size of our organization, locations of our offices, and users (amount of stuff they seem to put all over), we are unable to at this time. I agree though, it would work, just need to find out from TechDaddy123 if they do have roaming profiles.
 
I tried roaming profiles, and the idea is sound and pretty cool.

But in real life, in a network that has a mixture of XP and 2000, people jumping back and forth off notebook PC's and such, it was kind of a pain.

Roaming profiles was working for me, but people were picking up stray icons and other "all user" trash from other computers which had different programs installed than their original PC. Even the quicklaunch bar wasn't imune to changes. That was making me crazy. I removed roaming profiles for that reason.

Thanks for your feedback guys!

Keep up that good scriptin' work.

I'd like to find a way to just make the application settings area of the profile roaming though.
 
I think we all would like to have the application settings roaming. I have been trying to script it (for office settings), but it was getting to me too much so I had to take a break from it. I might hit it up again though....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top