Temporary Internet Files and Content.MSO in RDS


I have a server for thin clients, with folder redirection for My Documents and Desktop to a file server.  Technically this would mean that the C:\Users folder does only content about 10meg per user.

Well it's not the case, the following folders keep filling up :
C:\Users\%Username%\AppData\Local\Temporary Internet Files
C:\Users\%Username%\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5
C:\Users\%Username%\AppData\Local\Microsoft\Windows\Temporary Internet Files\\Low\Content.IE5
C:\Users\%Username%\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.MSO

Though a GPO forces the local cache not to be used, I can't find a setting to empty both IE cache folders and Outlook's attached items folder.

Question #1 : how can I stop this behavior ? I thought about a script to empty folders at logoff, but very "NT4-like".  I don't want to use roaming profiles, besides it won't solve the temp folders to be filled up, because I have folder redirection already, sorta beats the purpose.

Question #2 : why so many "Temporary Internet Files" location for one user ?

Question #3 : Can you control the way attached files work ? Location, extraction, etc.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DaBoagsAuthor Commented:
So I tried this script.  It works when I type the commands, but once it is saved into a BAT file it gives an error "(rd was expected" on the second line then stops.

So if I open manually a command prompt, and type :
for /F %F in ('dir /b /ah "%localappdata%\Microsoft\Windows\Temporary Internet Files\Content.Outlook\"') do @if exist %F\ (rd /s /q "%F") else (del /q "%F")

it works.

Run the batch file, with the exact same command, it returns :
(rd was expected

What gives ???
cd "%localappdata%\Microsoft\Windows\Temporary Internet Files\Content.Outlook"
for /F %F in ('dir /b /ah "%localappdata%\Microsoft\Windows\Temporary Internet Files\Content.Outlook\"') do @if exist %F\ (rd /s /q "%F") else (del /q "%F")

cd "%localappdata%\Microsoft\Windows\Temporary Internet Files\Content.MSO"
for /F %F in ('dir /b /ah "%localappdata%\Microsoft\Windows\Temporary Internet Files\Content.MSO"') do @if exist %F\ (rd /s /q "%F") else (del /q "%F")

cd "%localappdata%\Microsoft\Windows\Temporary Internet Files\Content.IE5"
for /F %F in ('dir /b /ah "%localappdata%\Microsoft\Windows\Temporary Internet Files\Content.IE5"') do @if exist %F\ (rd /s /q "%F") else (del /q "%F")

cd "%localappdata%\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5"
for /F %F in ('dir /b /ah "%localappdata%\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5"') do @if exist %F\ (rd /s /q "%F") else (del /q "%F")

cd "%localappdata%\Microsoft\Windows\Temporary Internet Files\Content.Word"
for /F %F in ('dir /b /ah "%localappdata%\Microsoft\Windows\Temporary Internet Files\Content.Word"') do @if exist %F\ (rd /s /q "%F") else (del /q "%F")

Open in new window

1. Have you looked at this setting (can set via policy)...

"Empty Temporary Internet Files folders when browser is closed"

C:\Users\%Username%\AppData\Local\Temporary Internet Files
Nothing is actually in this folder (besides these folders you have already listed). It is a cumulative combination of the ACTUAL content.ie5 and the Cookies folder..... You only see files in it if  browsing the current logged in files. It is a Shell Folder, hence the special behaviour.

C:\Users\%Username%\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5
This is where the ACTUAL Temporary Internet Files are stored in 6 character randomly named subfolders.

C:\Users\%Username%\AppData\Local\Microsoft\Windows\Temporary Internet Files\\Low\Content.IE5
This is where Protected Mode visits store the Temp Files.....

C:\Users\%Username%\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.MSO
This is the Outlook SecureTemp Folder.

Yes, they can all be changed. You do not want to change the Temporary Internet Files folder. It is the CACHE "Shell Folder" value that would need to be changed.....

You can change the Outlook SecureTemp folder path here....
 OutlookSecureTempFolder value is what you would want to modify....

That was the long answer to the whys......

In the batch file, remember the %F requires a second "%"....

for /F %%F in ('dir /b /ah "%localappdata%\Microsoft\Windows\Temporary Internet Files\Content.Outlook\"') do @if exist %%F\ (rd /s /q "%%F") else (del /q "%%F")

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DaBoagsAuthor Commented:
Excellent it works now, so %F when you type, %%F when you batch...

aaaah why always so complex...
Thanks a million John, you've saved 11gb on three servers today :)
Glad I could help.....

And you are right on the syntax... I usually test line by line in a CMD prompt, when writing a batch script, and often forget the % or %% issue.... Think thats why I caught it....  :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.