On both workstations and servers, Windows 2000 dedicates several directories to temporary files. One is for the system itself, in %SystemRoot%\Temp. The others are in the folder \Documents and Settings\<username>\Local Settings\Temp, where <username> is of course the user's name. One such TEMP directory exists for each user.

Many applications use these directories to deposit temporary files, as the name implies. The bad news is that not all of them clean up after themselves. After enough time and enough programs, the accumulation of junk files in the TEMP directories gets bad enough that many programs may begin to spontaneously fail.

This situation includes installer programs, which may be unable to unpack their contents into the TEMP directories for installation if there are other files with the same names there. If several different programs use the same installer technology with the same temporary file nomenclature, and the TEMP directories aren't cleaned up between each installation, things can get problematic if the installer refuses to overwrite what it thinks are its own files.

The best approach to this problem is regular hygiene: keep the TEMP directories empty. Because the system tends to lock many of the files in the TEMP directories while a user is logged in, the best approach involves a little side-stepping.

  1. Create a batch file to purge the contents of each TEMP directory. One way to do

    Requires Free Membership to View

  1. this is to use the RD /S command to completely remove the directory and all of its subdirectories, and then recreate it with MKDIR.

  2. Create a new user account that has Administrator permissions. For the ease of remembrance, call it purge. Do not assign it to more than one user group, as this may cause less-privileged user groups to override its Administrator privileges.

  3. Log out all other users, including the Administrator account, and log in as purge. Set up the batch file in the Startup folder so that it runs automatically when the login takes place. You can optionally add a logoff command at the end of the batch file so that the user is logged off when the cleanup operation is finished.

  4. Another option is to run the batch file as a scheduled job in the context of the purge user. This may create conflicts if other users are logged on at the time, so you may want to schedule it at an hour when it is unlikely that other users are logged on. (Note that this only covers users who are logged into the physical console or are connected via Terminal Services, not users who are accessing file shares.)

Serdar Yegulalp is the editor of the Windows 2000 Power Users Newsletter. Check out his Windows 2000 blog for his latest advice and musings on the world of Windows network administrators – please share your thoughts as well!


This was first published in July 2003

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.