Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Our application creates logs in the user's %TEMP% directory. Windows Server 2008 deletes the files on reboot. Is it possible to change this? Say not to delete any files from %TEMP% on reboot?

We do have mechanism to provide a different location for writing logs. I am curious to see if there is a setting that developer/administrator could control.

share|improve this question
The %TEMP% directory is for temporary files. It's name, by its very nature, defines its function. If these logs are needed for the longer term, you need to store them elsewhere. – Chris J Sep 22 '11 at 8:50
Consider using the system's %TEMP% folder instead. Better yet, place logs in a more appropriate place, such as by creating a logs folder. – John Gardeniers Sep 23 '11 at 5:46
up vote 2 down vote accepted

Assuming this is a terminal server...

Group Policy Management Console > Computer Settings > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > "Do not delete temp folder upon exit"

"If the status is set to Enabled, users' per-session temporary folders are retained when the user logs off from a session.

"If the status is set to Disabled, temporary folders are deleted when a user logs off, even if the administrator specifies otherwise in the Remote Desktop Session Host Configuration tool.

"If the status is set to Not Configured, Remote Desktop Services deletes the temporary folders from the remote computer at logoff, unless specified otherwise by the server administrator."

share|improve this answer

Rather than change your OS's behavior, a better solution would be to make your app not save logs to the user's %TEMP% directory...

share|improve this answer

As far as I can see, "Windows" does not delete the contents of user's %TEMP% - chances are you've defined a logon/logoff script that does.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.