No announcement yet.

Deleting temporary files from user profiles

  • Filter
  • Time
  • Show
Clear All
new posts

  • Deleting temporary files from user profiles

    Have Server 2003 operating as a terminal server. To keep disk useage to a managable size, I need to be able to delete temporary files (including internet) from the user folders. Is there a setting or VBS file that I can use? Thanks!

  • #2
    Re: Deleting temporary files from user profiles

    yes, there are VB scrits you can use to delete temporary files.
    you can also set a registry key that limits the size of the internet cache i beleive.

    or - better yet, prevent the users from using the internet on the termial server ?
    Please do show your appreciation to those who assist you by leaving Rep Point


    • #3
      Re: Deleting temporary files from user profiles

      And a 4th option is you could use Group Policy Preferences for this:
      - Group Policy Preferences in a Windows 2003 Domain (and a Windows 2008 Domain)
      - Clean up Those Pesky Temporary Internet Files Using Group Policy Preferences


      Instead of a vbscript, I once used this batch:
      :: Logoff script
      @echo off
      SetLocal EnableDelayedExpansion
      :: Clean IE-cache specialfolders of the user
      Set "FoldersToClear=Cookies,Cache,History"
      set "regkey=HKCU\Software\Microsoft\Windows\CurrentVersion"
      set "regkey=%regkey%\Explorer\shell folders"
      For %%* in (%FoldersToClear%) Do (
        Set sFldr=%%*
        For /f "tokens=2,*" %%A in (
          'reg.exe query "%regkey%" /v !sFldr!'
        ) do Call set "Target=%%B"
        If Exist "!Target!" (
          rem  taskkill.exe /IM iexplore.exe /F /T 2>nul
          Del /S /A /F /Q "!Target!\*"
          RMDIR /S /Q "!Target!\*"
      :: Clear also the user's Temp folder,
      If exist "%temp%" (
         PushD "%temp%" &&(
         ATTRIB -S -H -R -A /D /S
         Del /S /A /F /Q *)
      rem pause
      Last edited by Rems; 2nd July 2009, 15:46.

      This posting is provided "AS IS" with no warranties, and confers no rights.


      ** Remember to give credit where credit's due **
      and leave Reputation Points for meaningful posts


      • #4
        Re: Deleting temporary files from user profiles

        While this option isn't as smooth as Rem's enviable script, you could set the highlighted option in Internet Explorer. (It won't delete files from the Temp folder like Rem's will, just the IE temp files)

        Click image for larger version

Name:	empty-temp-ie-files.jpg
Views:	1
Size:	77.5 KB
ID:	464111
        Joined: 23rd December 2003
        Departed: 23rd December 2015