Temporary Internet Files and Content.MSO in RDS

Posted on 2011-10-02
Last Modified: 2012-05-12

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.

Question by:DaBoags

    Author Comment

    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

    LVL 66

    Expert Comment

    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....

    LVL 66

    Accepted Solution

    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")

    Author Closing Comment

    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 :)
    LVL 66

    Expert Comment

    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....  :)

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
    ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
    This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
    This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now