A user calls the service desk. A file they deleted last month has gone from the Recycle Bin. A second user cannot open a OneDrive spreadsheet on a train, because the local copy turned into a placeholder overnight. A third user lost an installer from Downloads that they had saved two days earlier. Nobody ran a cleanup. Nobody emptied anything. The common thread is a Windows feature called Storage Sense, and on almost every fleet it is running with defaults that no administrator ever chose.
Storage Sense is four independent cleanup levers behind one toggle: temporary files, Recycle Bin, Downloads folder, and OneDrive cloud-content dehydration. Only two of them do anything out of the box, because Microsoft documents the Downloads and cloud-content thresholds as defaulting to 0, which means never, while the Recycle Bin threshold defaults to 30 days and temporary-file cleanup defaults to on. There is no fixed clock either: the default cadence value is 0, meaning during low free disk space, and Microsoft publishes no percentage for what low means. Pin all six values under the documented policy key from Group Policy or the Intune Settings Catalog and the guesswork stops.
The problem: three different files, one silent cleaner
Storage Sense is the Windows feature that frees disk space on its own. Microsoft describes it as a feature that helps automatically free up disk space by deleting unnecessary files, such as temporary files, items in the recycle bin, and offline content from OneDrive. That one sentence hides four separate behaviours. Each one has produced a real support ticket.
The first is the Recycle Bin. Deleting a file into the Recycle Bin feels reversible. Users treat it as a safety net without knowing how deep the net is. It is thirty days deep, because thirty days is the documented default threshold. After that, Storage Sense removes the item permanently. There is no second bin behind the first one.
The second is the Downloads folder, and this is the lever that surprises people most. The condition is not how long ago the file was downloaded. It is how long ago the file was opened. The Settings app wording is "Delete files in my Downloads folder if they haven't been opened for more than:". A driver package saved on Monday for next week's rebuild has never been opened. If somebody set that threshold to one day, the file becomes a candidate on Tuesday.
The third is OneDrive. Storage Sense can take a locally cached OneDrive file and turn it back into an online-only placeholder. Microsoft calls that dehydration. The cloud copy is untouched and the file still appears in File Explorer, but the bytes are no longer on the disk. To a user on a plane, that is indistinguishable from the file being gone.
The fourth is temporary files, which is the least controversial of the four and the only one that is on by default.
Here is what the per-user configuration actually looks like on a device where nobody has applied policy. The value names are numeric and Microsoft does not document them.
Read that as: something is switched on for this user, and a OneDrive sync root has registered its own entry. What you cannot read from it reliably is which lever is which. That is the first half of the problem.
StoragePolicy are observed on a live device and are not documented by Microsoft. Community write-ups map them to individual toggles, and the mapping is probably right, but an undocumented value name can change in any monthly update. Never build Intune detection or remediation logic on them. Read the policy key instead, which is documented and stable.
The second half of the problem is that Storage Sense has no clock you can point at. Its default cadence value is 0, which Microsoft documents as "During low free disk space". So the answer to "when does this run" is "we do not publish that", and the answer to "what does it delete" depends on four thresholds that a user may have changed in Settings and that you probably have not pinned.
Why it happens: four levers, two scheduled tasks, defaults nobody picked
Start with what Storage Sense actually is, in plain English, before any configuration.
Windows ships a maintenance feature that watches free space on the system drive. When it decides to act, it walks a fixed list of cleanup categories. It removes anything matching the age rule for that category. It only touches the system drive. It runs under Automatic Maintenance rather than on a schedule you set. And it has a per-user side, because Downloads, the Recycle Bin and OneDrive caches all live inside user profiles.
The chain, from trigger to deleted file
Two scheduled tasks are involved. Confusing them is easy, because one of them is literally named StorageSense. On a Windows 11 24H2 device both exist, under different folders.
The task that does the deleting is \Microsoft\Windows\DiskCleanup\SilentCleanup. Its action, read straight off a live device, is %windir%\system32\cleanmgr.exe with the arguments /autocleanstoragesense /d %systemdrive%. It has no calendar trigger. It has a maintenance window instead, with a period of one day and a deadline of one month. It runs in the context of the Authenticated Users group at the highest available privilege. That is why the cleanup can reach into the signed-in user's profile.
The second task is \Microsoft\Windows\DiskFootprint\StorageSense. It is not an executable at all. Its action is a COM handler class identifier, which resolves in the registry to C:\Windows\System32\StorageUsage.dll under the friendly name "StorageUsage State Reporter Task Handler". It runs as SYSTEM, once a day inside the maintenance window. Its job is storage state reporting, not file deletion.
\Microsoft\Windows\DiskCleanup. It does not. Both folders are involved and they do different jobs. DiskFootprint\StorageSense is the state reporter. DiskCleanup\SilentCleanup is the one that invokes cleanmgr with the Storage Sense switch. If you are hunting for evidence of a deletion, look at SilentCleanup.
The switch /autocleanstoragesense deserves a warning. Microsoft's cleanmgr reference documents /d, /sageset:n, /sagerun:n, /tuneup:n, /lowdisk, /verylowdisk and /autoclean. It does not document /autocleanstoragesense. That switch is visible in the shipped task definition on the device, so it is observed and real, but it is undocumented. Treat it as an implementation detail rather than a supported interface, and do not script against it.
The levers and their documented defaults
Each lever has a separate policy value and a separate default. The numbers below come from the Storage Policy CSP reference, which is the authoritative source.
| Lever | Documented default | What it removes when active |
|---|---|---|
| Storage Sense itself | Policy default 0, meaning not enabled by policy | Nothing on its own. It is the master switch for everything below |
| Temporary files cleanup | 1, meaning on | The user's temporary files that are not in use |
| Recycle Bin threshold | 30 days | Items in the Recycle Bin older than the threshold, permanently |
| Downloads folder threshold | 0, meaning never | Files in Downloads not opened within the threshold |
| Cloud content dehydration threshold | 0, meaning never | Locally cached OneDrive files not opened within the threshold become online-only |
| Cadence | 0, meaning during low free disk space | Not a deletion lever. It decides when the others evaluate |
Read that table twice. Out of the box, two levers are live and two are dormant. Temporary-file cleanup is on. The Recycle Bin purges at thirty days. Downloads and OneDrive dehydration sit at 0, and Microsoft is explicit about what 0 means: "If you set this value to zero, Storage Sense won't delete files in the user's Downloads folder."
That is a genuinely useful triage fact. When a user reports a lost download or an unexpectedly dehydrated OneDrive file, the shipped default did not do it. Somebody changed a threshold. Either the user did it in the Settings app, or a policy in your own tenant did it. Find out which before you go looking for a Windows bug.
The low-free-space trigger, and what Microsoft will not tell you
Cadence value 0 is the default, and it means the run is condition-driven rather than clock-driven. The CSP text is that Storage Sense "is automatically turned on when the machine runs into low disk space and is set to run whenever the machine runs into storage pressure."
There are exactly four documented cadence values: 0 during low free disk space, 1 daily, 7 weekly, 30 monthly. The policy's own allowed range is the full 32-bit unsigned range, so nothing physically stops you writing 14. Only those four are documented, and the Group Policy dropdown offers only those four. Write one of the four.
How this interacts with OneDrive Files On-Demand
Dehydration only makes sense if OneDrive Files On-Demand is in play. Files On-Demand is the OneDrive feature that shows every cloud file in File Explorer while only downloading the ones you use. A file can be online-only, locally available, or pinned as always available on the device.
Storage Sense converts locally available files back to online-only when they have not been opened within the dehydration threshold. Two facts matter operationally. First, the OneDrive copy is not deleted. Microsoft states that "Online-only files stay safe in OneDrive and are visible on your device." Second, pinned files are exempt: "Files that you have marked to be always available are not affected and will continue to be available offline."
The relationship to cleanmgr and the StateFlags mechanism
Because SilentCleanup calls cleanmgr.exe, people reasonably assume Storage Sense thresholds and Disk Cleanup profiles are the same system. They are not. They share a binary and nothing else.
Disk Cleanup has its own, much older, saved-profile mechanism. You run cleanmgr /sageset:n, tick the handlers you want in the dialog, and Windows writes a REG_DWORD named StateFlagsNNNN into each cleanup handler's subkey. Microsoft documents the encoding precisely: "If the option box is not selected, the value is 00000000. If the option box is selected, the value is 00000002." You then run cleanmgr /sagerun:n to execute that saved profile. The handlers live under one parent key.
Two of the subkeys there are named Recycle Bin and DownloadsFolder, which is precisely why the two mechanisms get conflated. Ticking those boxes in a sageset profile is a completely separate decision from the Storage Sense day thresholds, and the profile you save has no effect on what Storage Sense does.
/d is documented as not being used with /sagerun:n, and that /sagerun enumerates every drive on the machine rather than only the one you had in mind.
StateFlags values do not exist until you run /sageset. On a clean device the subkeys carry Autorun and Flags values but no StateFlags values at all. That is expected, not a fault, and it is a useful way to tell whether anyone has ever built a Disk Cleanup profile on a machine.
Binaries, services and the rest of the plumbing
Only files verified present on a Windows 11 24H2 device are listed. Descriptions are the file descriptions read from the binaries themselves.
| File | Description on disk | Role in the flow |
|---|---|---|
| C:\Windows\System32\cleanmgr.exe | Disk Space Cleanup Manager for Windows | Does the actual deletion. Invoked by SilentCleanup, and by you interactively or with sageset and sagerun |
| C:\Windows\System32\StorageUsage.dll | Storage Usage | Hosts the COM class the DiskFootprint StorageSense task calls. Storage state reporting |
| C:\Windows\System32\SettingsHandlers_StorageSense.dll | System Settings Storage Handler Implementation | Backs the Settings app Storage Sense page. This is what writes the per-user StoragePolicy values |
| C:\Windows\System32\StorageContextHandler.dll | Device Center Storage Context Menu Handler | Shell context-menu surface for storage actions |
| C:\Windows\System32\disksnapshot.exe | DiskSnapshot.exe | Run by the sibling DiskFootprint Diagnostics task with -z. Footprint measurement, not cleanup |
| C:\Windows\System32\storsvc.dll | Storage Services | Implements the StorSvc service, hosted in svchost under LocalSystemNetworkRestricted |
| C:\Windows\PolicyDefinitions\StorageSense.admx | Administrative Template | Declares the six policies, their key, and their value names. Copy to a central store for domain use |
The service is StorSvc, display name Storage Service, start type Automatic, expected state Running. It is a shared svchost service and it does far more than Storage Sense, so do not disable it as a way of stopping cleanups. Use the policy.
How to verify: registry, tasks, events and the companion script
Verification has three parts. What policy says, what the user side says, and whether the tasks have actually run.
The documented policy key
Every centrally managed Storage Sense value lands in one key. This is the shared parent for the whole table below.
All six value names below are confirmed twice. Once in the Storage Policy CSP reference, and once in StorageSense.admx on the device, which declares the same key and the same value name for each policy element.
| Value name (REG_DWORD) | Allowed values | Meaning |
|---|---|---|
| AllowStorageSenseGlobal | 1 allow, 0 block. Default 0 | Master switch. Set 1 and users cannot turn Storage Sense off. Set 0 and users cannot turn it on, and every other value here becomes inert |
| ConfigStorageSenseGlobalCadence | 0, 1, 7 or 30. Default 0 | 0 during low free disk space, 1 daily, 7 weekly, 30 monthly |
| AllowStorageSenseTemporaryFilesCleanup | 1 allow, 0 block. Default 1 | Whether temporary files not in use are deleted. Users cannot change it once set |
| ConfigStorageSenseRecycleBinCleanupThreshold | 0 to 365. Default 30 | Age in days after which Recycle Bin items are permanently removed. 0 means never |
| ConfigStorageSenseDownloadsCleanupThreshold | 0 to 365. Default 0 | Days since a Downloads file was last opened before it is deleted. 0 means never |
| ConfigStorageSenseCloudContentDehydrationThreshold | 0 to 365. Default 0 | Days since a cloud-backed file was opened before it becomes online-only. 0 means never |
ConfigStorageSenseRecycleBinCleanupThreshold and ConfigStorageSenseDownloadsCleanupThreshold cause permanent deletion. There is no undo, no second Recycle Bin, and no per-path exclusion. Setting the Downloads threshold to a small number across a fleet will delete installers, exports and saved attachments that users kept deliberately but never re-opened. Pilot on a ring of volunteers before you touch anyone else. If you are unsure, write 0, which explicitly means never, rather than leaving the setting unconfigured and letting the user decide.
Reading the effective configuration by hand
This first console block reads the policy key and the per-user key in one pass. The policy key is authoritative. The per-user key tells you what the human chose.
Read the first result as the decision and the second as the preference. If a policy value is present, the matching control in the Settings app is greyed out and the user's stored preference stops mattering.
Checking the tasks that actually fire
Configuration without execution proves nothing. This block reads both tasks, their state, their last run time and their last result code.
The blank NextRunTime catches people out constantly. Both tasks carry a maintenance window rather than a trigger, so Task Scheduler genuinely has no next time to report.
Event Viewer: what exists, and what honestly does not
Microsoft publishes no Event IDs for Storage Sense. There is a channel named Microsoft-Windows-StorageSettings/Diagnostic, and on a live 24H2 device it is enabled with a 64 MB cap and contains zero events. So the honest position is that there is no Storage Sense event log to query. Anyone offering you a "cleanup completed" event ID for this feature is mistaken.
What you do get is Task Scheduler evidence, and that is enough to prove a run happened. These are the standard Task Scheduler operational IDs, filtered to the cleanup task.
| Event ID | Meaning | How to read it here |
|---|---|---|
| 100 | Task Scheduler started an instance of the task | A Storage Sense cleanup began. The user name on the event is the profile whose Downloads and Recycle Bin are in scope |
| 129 | Task Scheduler launched the task process | Gives you the cleanmgr.exe process ID, useful for correlating with other telemetry |
| 200 | Action started | Confirms the action was cleanmgr.exe and not something substituted for it |
| 201 | Action completed, with return code | Return code 0 is a clean completion. This is your evidence that the cleanup ran |
| 102 | Task instance finished successfully | Pair it with the matching 100 to get the run duration |
| 103 | Task Scheduler failed to start an instance | Carries an Error Value. Observed on the DiskFootprint task on a lab device with 0x80040154, the COM class-not-registered code |
Log files and PowerShell: two honest N/As
There is no Storage Sense log file. cleanmgr.exe writes no text log of what it removed, and there is no per-run manifest anywhere on disk. If you need a record of what was deleted, you have to capture the configuration before the fact, which is exactly what the companion script is for. Do not spend an afternoon hunting for a log that does not exist.
There is also no Storage Sense PowerShell module. That is worth proving rather than asserting.
storage-sense-disk-cleanup-policy. It never triggers a cleanup, never writes a registry value, and exits 1 rather than printing a clean-looking report if any read fails.
The fix: pin every lever centrally, Intune and Group Policy
The fix is not "turn Storage Sense off". Low disk space blocks Windows updates and degrades performance, and Microsoft frames Storage Sense as a way to keep update installs unblocked on small-disk devices. The fix is to make the behaviour a decision you made, wrote down, and applied identically everywhere.
Decide these six values before you open a portal.
| Setting | A defensible starting point | Why |
|---|---|---|
| Allow Storage Sense Global | Allow | Makes the feature deterministic instead of self-enabling when the disk gets tight |
| Config Storage Sense Global Cadence | 7, weekly | A known day beats "sometime during storage pressure". Daily is reasonable on 64 GB devices |
| Allow Storage Sense Temporary Files Cleanup | Allow | Lowest-risk lever. It only touches temporary files that are not in use |
| Config Storage Sense Recycle Bin Cleanup Threshold | 30, or 0 if your users treat the bin as a backup | 30 matches the documented default, so pinning it changes nothing while removing the drift |
| Config Storage Sense Downloads Cleanup Threshold | 0, never | This is the lever that generates tickets. 0 disables it and stops a user enabling it |
| Config Storage Sense Cloud Content Dehydration Threshold | 0 for laptop and field users, 30 or 60 for small-disk desk devices | Dehydration is harmless on a wired desk PC and painful for anyone who works offline |
Microsoft Intune, step by step
These settings live in the Settings Catalog under the Storage category. They are not in a Templates profile, and they are not under an Administrative Templates node in Intune.
- Sign in to the Microsoft Intune admin center at intune.microsoft.com.
- Go to Devices, then Configuration, then select Create and New policy.
- Set Platform to Windows 10 and later.
- Set Profile type to Settings catalog, then select Create.
- Name the profile something a future colleague will understand, for example W11 - Storage Sense baseline. Put the thresholds and the reason in the description.
- On the Configuration settings tab, select Add settings.
- In the settings picker, browse to or search for the category Storage.
- Tick all six settings: Allow Storage Sense Global, Allow Storage Sense Temporary Files Cleanup, Config Storage Sense Global Cadence, Config Storage Sense Recycle Bin Cleanup Threshold, Config Storage Sense Downloads Cleanup Threshold and Config Storage Sense Cloud Content Dehydration Threshold.
- Close the picker. Set Allow Storage Sense Global to Allow.
- Set Allow Storage Sense Temporary Files Cleanup to Allow.
- Set Config Storage Sense Global Cadence from the dropdown. The four options are 0 - Only when disk space is low, 1 - Daily, 7 - Weekly and 30 - Monthly.
- Type the three threshold values. Each accepts a whole number in the range 0-365. Remember that 0 means never for all three.
- Select Next through Scope tags.
- On Assignments, add a device group. Start with a pilot ring, not All devices.
- Review the summary, then select Create.
- Confirm delivery under Devices, then Configuration, then your profile, then Device status. Then confirm on an actual device by reading the policy key with the console block above. A green portal is not the same thing as a written registry value.
If you would rather use a custom profile, the OMA-URIs are documented. Each one is ./Device/Vendor/MSFT/Policy/Config/Storage/ followed by the value name, with data type Integer. There is no reason to prefer that over the Settings Catalog now that the settings are present in the picker, but it is handy for narrow exception profiles.
Group Policy, step by step
The Administrative Template is StorageSense.admx, which ships in C:\Windows\PolicyDefinitions on Windows 11. If you use a central store, copy it and its language file there first.
- Open the Group Policy Management Console, or gpedit.msc for a single machine.
- Create or edit a Group Policy Object linked to the organisational unit holding your Windows 11 devices.
- Navigate to Computer Configuration, then Policies, then Administrative Templates, then System, then Storage Sense.
- Open Allow Storage Sense, select Enabled, then OK. Enabled writes
AllowStorageSenseGlobal = 1. - Open Allow Storage Sense Temporary Files Cleanup, select Enabled, then OK.
- Open Config Storage Sense Global Cadence, select Enabled, then choose from the dropdown: Every day, Every week, Every month or During low free disk space.
- Open Config Storage Sense Recycle Bin Cleanup Threshold, select Enabled, and type a number from 0 to 365.
- Open Config Storage Sense Downloads Cleanup Threshold, select Enabled, and type a number from 0 to 365. Type 0 if you want this lever dead.
- Open Config Storage Sense Cloud Content Dehydration Threshold, select Enabled, and type a number from 0 to 365.
- Close the editor, then run
gpupdate /target:computer /forceon a test device. - Verify by reading the policy key. Six values should be present, and the numbers should be the ones you typed.
- Open Settings, then System, then Storage, then Storage Sense and confirm the controls are greyed out. The shortcut
ms-settings:storagepoliciesopens that page directly, andms-settings:storagesenseopens the parent Storage page.
Defender and security policy: not applicable, and here is why
Storage Sense has no relationship to Microsoft Defender, Attack Surface Reduction, exploit protection, Windows Defender Application Control or the firewall. There is no Endpoint Security profile that affects it, and no ASR rule that blocks it. The one adjacent point is that Disk Cleanup registers a Windows Defender handler under the VolumeCaches key, which lets a sageset profile remove old Defender scan artefacts. That is a Disk Cleanup handler, not a security control, and selecting it changes no Defender setting.
Proof it worked: a real read-only run
The output below is a genuine run of the companion script on a Windows 11 24H2 device under Windows PowerShell 5.1, with the computer name, user name and OneDrive identifiers replaced. Nothing else has been edited. This device has no Storage Sense policy applied, which is exactly the unmanaged baseline the article is about.
That is the whole argument for this article on one screen. The device has no policy. The master switch is user-controlled. Temporary files and the Recycle Bin are live. Downloads and cloud dehydration are dormant at 0. So if a user on this device lost a download, Storage Sense did not do it, and the investigation should go elsewhere.
After applying the baseline profile, the same run should show six configured values, a source of POLICY named against every lever, and a closing verdict that matches what you wrote down beforehand. That is the acceptance test. Not "the portal says succeeded", but "the script on the device agrees with my decision".
The script was verified with zero parse errors on both Windows PowerShell 5.1 and PowerShell 7. It contains zero non-ASCII characters, uses no null-conditional operators, and calls no cmdlet whose verb writes. It exits 1 with an explicit abort message if any read fails, so a clean report is always a real one rather than a silent gap.
Community deep-dives verified for this post
| Author | Link | What it adds |
|---|---|---|
| Anoop C Nair | Managing the Storage Sense Policy in Windows using Intune | Screenshot-led walkthrough of the Settings Catalog policy, including creating, assigning and removing the assignment. Fetched and confirmed as loading and on-topic |
References
- Configure Storage Sense in Windows - Microsoft Learn. The Intune Settings Catalog category and setting names, the Group Policy path, the CSP OMA-URIs and the cadence options.
- Storage Policy CSP - Microsoft Learn. The authoritative source for all six value names, their allowed ranges, their defaults, and what 0 means for each threshold.
- cleanmgr command reference - Microsoft Learn. The documented switches, and the 0 to 9999 range for the sageset profile number.
- Automating the Disk Cleanup tool - Microsoft Learn. The VolumeCaches key, the StateFlags value naming, and the 0 or 2 encoding.
- Launch Windows Settings - Microsoft Learn. Confirms
ms-settings:storagesensefor the Storage page andms-settings:storagepoliciesfor the Storage Sense page. - Manage drive space with Storage Sense - Microsoft Support. The end-user wording for each toggle, including the Downloads condition of not having been opened.
- Use OneDrive and Storage Sense to manage disk space - Microsoft Support. Dehydration behaviour, the 30-day figure, and the pinned-files exemption.
- Get-StorageSensePolicy.ps1 - the read-only companion script for this post.
Download it from Imran76Awan/Windows-11-Scripts — no sign-in required. It is read-only: it reports and never changes a device or anything in Intune. Validate it in your own environment before relying on the output.