0

Operating System: Windows server 2019

The problem:

  1. One of our servers has a lot of accumulated files under c:\windows\temp folder.

  2. Disk cleaner doesn't seem to delete those files - it always reports 4 GB of 'temporary files' even after multiple runs.

  3. On manual delete attempt, given a permission error. "You need permission to perform this action. You require permission from the computer's administrator to make changes to this folder"

  4. Tried deleting using both 'local' administrator and 'domain' administrator users.

  5. Security settings for "Temp" folder indicates "SYSTEM" is owner.

Question:

Is there a way to delete the files under said "Temp" folder? A bit worried to try and change folder owner since its a running production server.

enter image description here

enter image description here

enter image description here

3 Answers 3

1

Most Windows tools can be set up to delete the files after reboot. This avoids the issue of their being locked while the PC is operating. There are third-party drive cleanup tools such as Wise Disk Cleaner and alternatives, though you might not want to install a third-party tool on a server.

You can also use Sysinternals' (a Microsoft division), MoveFiles to schedule deletion on reboot.

1

Keep in mind, the temp folder is being used to write to by programs currently running. It is normal to find files in the temp folder that are currently in use by another program.

The weird thing comes next, windows does not always give you the message "This file is use by another program" but instead may give you a "permission denied" error instead.

It is likely that you currently face a file-is-in-use problem rather than a permission error.

This is especially the case if you try to delete a folder with a file in it, where the file is in use, but not necessarily the folder itself.

0

You could try running under the SYSTEM account to delete these files. You shouldn't be able to delete files that are in use, so this is relatively safe.

The following utilities can help you execute explorer.exe under the SYSTEM account:

Once in Explorer as SYSTEM, you may position to C:\Windows\Temp, select all (Ctrl-A) and delete (Del). When prompted, answer to Skip all problematic files.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .