In Windows 10 1809 Storage sense was introduces it is a cool feature to allow Windows 10 cleanup in local storage on the end user behalf – before Windows 10 1903 there is no way of configure this with a MDM policy. So the solution was to deploy some registry entries with a powershell script from Intune.
The settings that can be configured is:
- Storage/AllowDiskHealthModelUpdates
- Storage/AllowStorageSenseGlobal
- Storage/AllowStorageSenseTemporaryFilesCleanup
- Storage/ConfigStorageSenseCloudContentDehydrationThreshold
- Storage/ConfigStorageSenseGlobalCadence
- Storage/ConfigStorageSenseRecycleBinCleanupThreshold
- Storage/EnhancedStorageDevices
- Storage/RemovableDiskDenyWriteAccess
I will not describe em all in this blog post – only those that makes most sense in my experience.
You need to configure AllowStorageSenseGlobal so that Storage Sense will be turned on.
Storage Sense is turned off be default, but if not configured it will be enabled when the disk is running low on free space. Then it will start cleaning temporary files like:
- Temporary setup files
- Old indexed content
- System cache files
- Internet cache files
- Device Driver packages
- System downloaded program files
- Dated system log files
- System error memory dump files
- System error minidump files
- Temporary system files
- Dated Windows update temporary files
You can disable cleaning up temporary files by using this setting: AllowStorageSenseTemporaryFilesCleanup
When starting using OneDrive Known Folder Move combined with Files on-demand then this setting come in handy to “delete” data on the device – or more correctly make the files cloud only aka on-demand again
How to configure it in Intune:
Start the Microsoft 3654 Device management portal https://devicemanagement.microsoft.com/
- Click Device Configuration
- Click Profiles
- Click Create profile
- Name : Windows 10 – Custom Storage Sense
- Platform : Windows 10 and later
- Profile type : Custom
- Click Settings Configure
- Click Add
If you enable this policy setting without setting a cadence, Storage Sense is turned on for the machine with the default cadence of “during low free disk space.”
- Name : AllowStorageSenseGlobal
- Description : Turn Storage Sense is on
- OMA-URI : ./Device/Vendor/MSFT/Policy/Config/Storage/AllowStorageSenseGlobal
- Data Type : Select Integer
- Value : 1
When Storage Sense runs, it can delete the user’s temporary files that are not in use.
- Name : AllowStorageSenseTemporaryFilesCleanup
- Description : Number of days since a cloud-backed file has been opened before Storage Sense will dehydrate it
- OMA-URI : ./Device/Vendor/MSFT/Policy/Config/Storage/AllowStorageSenseTemporaryFilesCleanup
- Data Type : Select Integer
- Value : 1
When Storage Sense runs, it can dehydrate cloud-backed content that hasn’t been opened in a certain amount of days.
- Name : ConfigStorageSenseCloudContentDehydrationThreshold
- Description : Number of days since a cloud-backed file has been opened before Storage Sense will dehydrate it
- OMA-URI : ./Device/Vendor/MSFT/Policy/Config/Storage/ConfigStorageSenseCloudContentDehydrationThreshold
- Data Type : Select Integer
- Value : 30
When Storage Sense runs, it can delete files in the user’s Downloads folder if they have been there for over a certain amount of days.
- Name : ConfigStorageSenseDownloadsCleanupThreshold
- Description : Minimum age threshold (in days) of a file in the Downloads folder before Storage Sense will delete it
- OMA-URI : ./Device/Vendor/MSFT/Policy/Config/Storage/ConfigStorageSenseDownloadsCleanupThreshold
- Data Type : Select Integer
- Value : 90
When Storage Sense runs, it can delete files in the user’s Recycle Bin if they have been there for over a certain amount of days.
- Name : ConfigStorageSenseRecycleBinCleanupThreshold
- Description : Minimum age threshold (in days) of a file in the Recycle Bin before Storage Sense will delete it
- OMA-URI : ./Device/Vendor/MSFT/Policy/Config/Storage/ConfigStorageSenseRecycleBinCleanupThreshold
- Data Type : Select Integer
- Value : 7
Storage Sense can automatically clean some of the user’s files to free up disk space. If the Storage/AllowStorageSenseGlobal policy is disabled, then this policy does not have any effect.
- Name : ConfigStorageSenseGlobalCadence
- Description : Storage Sense cadence
- OMA-URI : ./Device/Vendor/MSFT/Policy/Config/Storage/ConfigStorageSenseGlobalCadence
- Data Type : Select Integer
- Value : 7
Then you have a complete policy for Storage Sense that you can apply to your end user.
Download import script into Intune : https://github.com/PerLarsen1975/Script_DeployedWithIntune/blob/master/DeviceConfiguration_Add_Windows_Custom%20-%20Storage%20Sense.ps1
How does it looks like from the End user perspective:
In the settings apps under System – Storage
The end user can now see that the settings is managed by your organization.
It is on do to the policy just set – and the end user cannot disable it.
Read more:
Policy CSP – Storage
What’s new in Storage Sense?
Hi Per, Can you also share the reg keys and scripts for older win10 machines?
Per thank you for sharing all of this!
i configured storage sense exactly the way you discribed here and assigned it to a sercurity group of users. –> getting -2016281112 (Remediation failed) errors in Intune. found out you might need to assign it to devices? so i added the devices to the security group. But still getting -2016281112 (Remediation failed) errors.
Any advice what might be wrong?
(M365 E3 License – devices all on 1806 Enterprise)
You need to use Windows Insider – it is a Windows 10 1903 feature
Ahhhhh thank you – sorry, i should have read the first 3 lines of your post ;-). Anyways thanks for sharing your knowledge it really helps a lot!
I am testing this on a Kiosk device, but I do not see the files being deleted in the Downloads folder. I have set ConfigStorageSenseGlobalCadence and ConfigStorageSenseDownloadsCleanupThreshold to 1 day as I want these download files cleared quickly. Any ideas?
Are you running Windows 10 1903??
Yes
I too ran a brand new install of 1903 and im also gettings remediation failed
.AllowStorageSenseGlobal [./Device/Vendor/MSFT/Policy/Config/Storage/.AllowStorageSenseGlobal]
Error
-2016281112 (Remediation failed)
.AllowStorageSenseTemporaryFilesCleanup [./Device/Vendor/MSFT/Policy/Config/Storage/.AllowStorageSenseTemporaryFilesCleanup]
Error
-2016281112 (Remediation failed)
.ConfigStorageSenseCloudContentDehydrationThreshold [./Device/Vendor/MSFT/Policy/Config/Storage/.ConfigStorageSenseCloudContentDehydrationThreshold]
Error
-2016281112 (Remediation failed)
.ConfigStorageSenseDownloadsCleanupThreshold [./Device/Vendor/MSFT/Policy/Config/Storage/.ConfigStorageSenseDownloadsCleanupThreshold]
Error
-2016281112 (Remediation failed)
.ConfigStorageSenseGlobalCadence [./Device/Vendor/MSFT/Policy/Config/Storage/.ConfigStorageSenseGlobalCadence]
Error
-2016281112 (Remediation failed)
.ConfigStorageSenseRecycleBinCleanupThreshold [./Device/Vendor/MSFT/Policy/Config/Storage/.ConfigStorageSenseRecycleBinCleanupThreshold]
Error
-2016281112 (Remediation failed)
If you could give me any pointers i would be really grateful
Regards
Martin