Disable Storage Sense to Delete Temporary Files in Windows 10

Hard Drive Disk Hdd Icon Big

As you may already know, Windows 10 includes the ability to automatically delete files in your Recycle bin, delete temporary files, and files in the Downloads folder to free up disk space. In recent Windows 10 builds, Storage Sense can automatically delete temporary files for your user account. Here is how to change its options.

Temporary files are created by various Windows services, installed apps and tools. Temporary files can be safely deleted after the process which has created them has quit. However, this does not happen often, so the system temporary directory or the app's temp directory continues to store them and fills your disk drive with junk. When this option is enabled, Windows will delete them automatically and keep you drive clean besides saving your disk space.

Storage Sense is a nice, modern replacement for Disk Cleanup. It allows you to maintain certain folders by preventing them from getting too large and clean them up automatically. The Storage Sense feature can be found in Settings, under System -> Storage.

Storage Sense can be used to remove Windows upgrade log files, system-created Windows Error Reporting Files, Windows Defender Antivirus temporary files, Thumbnails, Temporary Internet Files, Device driver packages, DirectX Shader Cache, Downloaded Program Files,  Delivery Optimization Files, old System log files, System error memory dump files and minidumps, temporary Windows update files, and more.

While you can clear the %temp% folder manually (references: article #1, article #2, article #3), you can automate this process using Storage Sense. This feature is enabled by default in WIndows 10. Here is how to disable or re-enable it.

Disable Storage Sense to Delete Temporary Files in Windows 10

  1. Open Settings.
  2. Go to System - Storage.
  3. Turn on the Storage sense option on the right.
  4. On the right, click on the Configure Storage Sense or run it now link.
  5. On the next page, navigate to the Temporary files section.
  6. Turn off (uncheck) the option Delete temporary files that my apps aren't using.

You can re-enable the feature by turning on the check box Delete temporary files that my apps aren't using at any moment.

Alternatively, you can apply a Registry tweak to enable or disable this option.

Prevent Storage Sense from Deleting Temporary Files with a Registry Tweak

  1. Open the Registry Editor app.
  2. Go to the following Registry key.
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy

    See how to go to a Registry key with one click.

  3. On the right, modify or create a new 32-Bit DWORD value 04.
    Note: Even if you are running 64-bit Windows you must still create a 32-bit DWORD value.
    Set its value to 0 to disable the feature. A value data of 1 will enable it.
  4. To make the changes done by the Registry tweak take effect, you need to sign out and sign in to your user account.

You can download the following ready-to-use Registry files.

Download Registry Files

The undo tweak is included.

Finally, you can use Local Group Policy.

Disable Storage Sense to Delete Temporary Files with Local Group Policy

If you are running Windows 10 Pro, Enterprise, or Education edition, you can use the Local Group Policy Editor app to force disable or enable the Delete Temporary Files feature for all users. The policy is available starting in Windows 10 Build 18282. See How to find the Windows 10 build number you are running.

Here is how.

  1. Press Win + R keys together on your keyboard and type:
    gpedit.msc

    Press Enter.

  2. Group Policy Editor will open. Go to Computer Configuration\Administrative Templates\System\Storage Sense. Enable the policy option Allow Storage Sense Temporary Files cleanup.
  3. Set it to Enabled to make it always enabled for all users.
  4. Set it to Disable to keep it always disabled for all users.
  5. The default (Not Configured) state will allow users to change the options using the Settings app.

If your Windows 10 edition doesn't come with the Local Group Policy Editor app, you can apply a Registry tweak instead.

Configure the policy option with a Registry tweak

  1. Open Registry Editor.
  2. Go to the following Registry key:
    HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\StorageSense

    Tip: See how to jump to the desired Registry key with one click.

    If you do not have such a key, then just create it.

  3. Here, create a new 32-bit DWORD value AllowStorageSenseTemporaryFilesCleanup. Note: Even if you are running 64-bit Windows, you still need to use a 32-bit DWORD as the value type.
    Set it to 0 to force disable the feature for all users. A value data of 1 will forcibly enable it for all users.
  4. To make the changes done by the Registry tweak take effect, you need to Restart Windows 10.

Later, you can delete the AllowStorageSenseTemporaryFilesCleanup value to cancel the restriction. Don't forget to restart the OS after that.

You can download the following ready-to-use Registry files.

Download Registry Files

The Group Policy-related files are under the Group Policy folder in the ZIP archive.

That's it.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

One thought on “Disable Storage Sense to Delete Temporary Files in Windows 10”

Leave a Reply

Your email address will not be published.

Exit mobile version
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.