Mastodon
MicrosoftWindows Server 2025

How To Auto Delete Temp Files on All Domain Computers Using GPO Storage Sense

19views

Introduction

Disk space bloat from temporary files is a silent performance killer across enterprise environments. As an IT administrator managing dozens or hundreds of domain-joined Windows machines, manually cleaning up Temp files, Recycle Bin contents, and cached data is simply not scalable.

Windows 10/11 includes a powerful built-in feature called Storage Sense that automatically frees disk space by removing temporary files, old downloads, and content from the Recycle Bin. The challenge? By default, Storage Sense is not enforced across domain computers — each user can toggle it on or off freely.

The solution: Deploy and enforce Storage Sense settings centrally using Group Policy Objects (GPO) from your Windows Server 2025 Domain Controller. In this guide, you will learn exactly how to configure a GPO that automatically enables Storage Sense, runs it on a schedule, and silently deletes temp files across every domain computer — without any user interaction required.

Why Use GPO to Manage Storage Sense?

Managing Storage Sense through Group Policy gives IT administrators centralized, consistent control over disk hygiene. Here is why this approach is the enterprise best practice:

  • Centralized control: Configure once on the Domain Controller, apply to all computers in an OU or the entire domain.
  • No user action required: Storage Sense runs silently in the background without end-user involvement.
  • Consistent enforcement: Even if a user disables Storage Sense manually, GPO will re-enforce the setting at the next Group Policy refresh.
  • Compliance & audit readiness: Maintain a clean, documented cleanup policy that satisfies organizational IT governance requirements.
  • Performance improvement: Regular cleanup reduces disk fragmentation, speeds up profile loading, and extends SSD lifespan.
  • Reduced helpdesk tickets: Proactively prevents ‘disk full’ errors on workstations — one of the most common support requests.

What Is Windows Storage Sense?

Storage Sense is a built-in Windows 10/11 disk optimization feature that automatically identifies and removes the following categories of temporary or unnecessary files:

File CategoryWhat Gets Cleaned
Temporary FilesFiles in %TEMP%, Windows\Temp, and other system temp locations
Recycle BinFiles that have been in the Recycle Bin beyond a defined number of days
Downloads FolderFiles in the Downloads folder older than a specified threshold
Previous Windows InstallationsOld Windows.old folders from feature upgrades
Delivery Optimization FilesCached Windows Update delivery files no longer needed
Thumbnails CacheThumbnail cache files used by File Explorer

When enforced via GPO, Storage Sense runs automatically at a cadence you define — every day, every week, or every month — without requiring administrative login on each machine.

Prerequisites

Before configuring this GPO, ensure the following are in place in your environment:

  • Windows Server 2025 (or 2022) acting as Domain Controller
  • Active Directory domain with domain-joined Windows 10 or Windows 11 clients
  • Group Policy Management Console (GPMC) installed on the Domain Controller or management workstation
  • Domain Admin or Group Policy Creator Owners privileges
  • Windows 11 22H2 or later on client machines (Storage Sense GPO templates are included in Windows 11 ADMX templates)
  • Central Store configured for ADMX templates (recommended) OR local PolicyDefinitions folder on the DC
💡 PRO TIP: If Storage Sense GPO settings are not visible in Group Policy Management Editor, you may need to copy the latest Windows 11 ADMX templates to your Central Store. Path: \\YOURDOMAIN\SYSVOL\YOURDOMAIN\Policies\PolicyDefinitions

Storage Sense GPO Settings Reference

All Storage Sense GPO settings are located under the following path in Group Policy Management Editor:

Computer Configuration > Administrative Templates > System > Storage Sense

GPO SettingDescription & Recommended Value
Allow Storage SenseEnables Storage Sense feature. Set to: Enabled
Configure Storage Sense Cloud Content Dehydration ThresholdDays before cloud files go offline. Recommended: 30 days
Configure Storage Sense Downloads Cleanup ThresholdDays before Downloads folder files are removed. Recommended: 60 days
Configure Storage Sense Recycle Bin Cleanup ThresholdDays before Recycle Bin items are deleted. Recommended: 14 days
Configure Storage Sense CadenceHow often Storage Sense runs: Daily, Weekly, Monthly, or Low Free Disk Space. Recommended: Weekly
Configure Storage Sense Temporary Files CleanupRemoves temp files Storage Sense manages. Set to: Enabled
Force Storage Sense execution on low disk spaceTriggers Storage Sense when disk space is low. Recommended: Enabled

Step-by-Step GPO Configuration

Step 1: Open Group Policy Management Console

On your Windows Server 2025 Domain Controller, open Server Manager and navigate to Tools > Group Policy Management. Alternatively, run gpmc.msc from the Run dialog.

Step 2: Create a New GPO

In the Group Policy Management Console tree, right-click on the Organizational Unit (OU) that contains your domain computers, or right-click on the domain itself to apply it domain-wide. Select Create a GPO in this domain, and Link it here.

Name the GPO something descriptive and searchable, such as:

CORP-Storage-Sense-TempCleanup

Step 3: Edit the GPO

Right-click the newly created GPO and select Edit. This opens the Group Policy Management Editor.

Navigate to:

Computer Configuration > Policies > Administrative Templates > System > Storage Sense

Step 4: Enable and Configure Storage Sense

Configure each of the following settings by double-clicking them and setting to Enabled:

  1. Double-click Allow Storage Sense — set to Enabled.
  2. Double-click Configure Storage Sense Cadence — set to Enabled, then set the drop-down to Every Week.
  3. Double-click Configure Storage Sense Temporary Files Cleanup — set to Enabled.
  4. Double-click Configure Storage Sense Recycle Bin Cleanup Threshold — set to Enabled, enter 14 (days).
  5. Double-click Configure Storage Sense Downloads Cleanup Threshold — set to Enabled, enter 60 (days).
  6. Double-click Configure Storage Sense Cloud Content Dehydration Threshold — set to Enabled, enter 30 (days).
  7. Click OK after each setting.

Step 5: Force GPO Refresh or Wait

Group Policy refreshes automatically every 90 minutes (with a 0–30 minute random offset) on domain-joined computers. To force an immediate update, run the following from an elevated Command Prompt on any domain client:

gpupdate /force

Or push it from the Domain Controller using PowerShell to all computers:

Invoke-GPUpdate -Computer ‘CLIENT01’ -Force

Step 6: Verify Storage Sense Is Active on Client

Log into a domain-joined client machine and navigate to Settings > System > Storage > Storage Sense. You should see that Storage Sense is turned on and the Run Storage Sense field shows your configured schedule.

To verify via PowerShell on the client:

Get-ItemProperty ‘HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy’ | Select-Object *

Registry Keys Reference

For advanced administrators who prefer scripting or direct registry management, the Storage Sense configuration is stored in the following registry locations:

Registry ValueLocation & Description
01 (StorageSenseOn)HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy — Enables Storage Sense (1 = On)
2048 (Cadence)Same path above — Schedule: 1=Daily, 7=Weekly, 30=Monthly, 0=Low disk space only
04 (TempFiles)Same path above — Delete temp files (1 = Enabled)
08 (RecycleBin)Same path above — Recycle Bin cleanup enabled (1 = Yes)
256 (RecycleBin Days)Same path above — Number of days before Recycle Bin items are deleted
32 (Downloads)Same path above — Downloads folder cleanup enabled (1 = Yes)
512 (Downloads Days)Same path above — Number of days before Downloads items are deleted

Troubleshooting Common Issues

IssueResolution
Storage Sense settings not visible in GPO EditorCopy Windows 11 ADMX templates to Central Store: \\DOMAIN\SYSVOL\DOMAIN\Policies\PolicyDefinitions
GPO applied but Storage Sense still off on clientRun gpupdate /force on client. Check RSoP with rsop.msc or gpresult /r
Storage Sense runs but temp files remainVerify the specific temp file location is covered. Some app-specific temp folders require custom cleanup scripts
Settings reverting after GPO refreshEnsure GPO is linked to the correct OU and computer accounts are in that OU. Check for conflicting GPOs with higher precedence
Storage Sense not showing in Settings on clientEnsure client is running Windows 10 1803+ or Windows 11. Feature may be unavailable on Windows Server OS client images

Bonus: PowerShell Script to Audit Storage Sense Compliance

Use this PowerShell script on your Domain Controller to remotely check if Storage Sense is enabled across all domain computers:

# Run on Domain Controller — Audit Storage Sense across domain $computers = Get-ADComputer -Filter {OperatingSystem -Like 'Windows 10*' -or OperatingSystem -Like 'Windows 11*'} | Select-Object -ExpandProperty Name  foreach ($pc in $computers) {     Try {         $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('CurrentUser', $pc)         $key = $reg.OpenSubKey('SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy')         $val = $key.GetValue('01')         Write-Output "$pc : StorageSense Enabled = $val"     } Catch {         Write-Output "$pc : UNREACHABLE or ERROR"     } }

Frequently Asked Questions (FAQ)

Does Storage Sense GPO affect servers or only workstations?

The Storage Sense GPO settings under Computer Configuration apply to domain-joined Windows 10 and Windows 11 workstations. Windows Server OS does not include the Storage Sense feature by default and is not affected by these policies.

Will Storage Sense delete files that are currently open?

No. Storage Sense only removes files that are not in use. Locked or open files are skipped during the cleanup cycle and will be evaluated during the next scheduled run.

Can users override the GPO-enforced Storage Sense settings?

When the GPO is configured using Computer Configuration with the Enabled setting, user-side changes through the Settings app are restricted. However, using User Configuration settings allows users to override. Prefer Computer Configuration for enforced enterprise policies.

How do I target Storage Sense GPO to specific computers only?

Link the GPO to a specific Organizational Unit (OU) that contains only the target computer accounts. Alternatively, use GPO Security Filtering or WMI filters to target specific hardware models, OS versions, or department groups.

Does Storage Sense clean the C:\Windows\Temp folder?

Yes. Storage Sense cleans the Windows temporary files folder (C:\Windows\Temp) as part of its system temporary files cleanup, in addition to user-profile temp folders (%TEMP% and %TMP%).

Conclusion

Deploying Storage Sense via Group Policy is one of the most efficient and low-risk ways to automate disk hygiene across your entire Windows domain environment. With Windows Server 2025 and modern Windows 11 clients, this configuration is fully supported, centrally managed, and completely transparent to end users.

Leave a Response

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
100% Free SEO Tools - Tool Kits PRO