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

Temp files

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

Onedrive


How to configure it in Intune:

Start the Microsoft 3654 Device management portal https://devicemanagement.microsoft.com/

  1. Click  Device Configuration
  2. Click Profiles
  3. Click Create profile

Storage Sense - Intune CSP - 00

  1. Name : Windows 10 – Custom Storage Sense
  2. Platform : Windows 10 and later
  3. Profile type : Custom
  4. Click Settings Configure
  5. Click Add

Storage Sense - Intune CSP - 01

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.”

  1. Name : AllowStorageSenseGlobal
  2. Description : Turn Storage Sense is on
  3. OMA-URI :  ./Device/Vendor/MSFT/Policy/Config/Storage/AllowStorageSenseGlobal
  4. Data Type : Select Integer
  5. Value : 1

Storage Sense - Intune CSP - 02

When Storage Sense runs, it can delete the user’s temporary files that are not in use.

  1. Name : AllowStorageSenseTemporaryFilesCleanup
  2. Description : Number of days since a cloud-backed file has been opened before Storage Sense will dehydrate it
  3. OMA-URI :  ./Device/Vendor/MSFT/Policy/Config/Storage/AllowStorageSenseTemporaryFilesCleanup
  4. Data Type : Select Integer
  5. Value : 1

Storage Sense - Intune CSP - 03

When Storage Sense runs, it can dehydrate cloud-backed content that hasn’t been opened in a certain amount of days.

  1. Name : ConfigStorageSenseCloudContentDehydrationThreshold
  2. Description : Number of days since a cloud-backed file has been opened before Storage Sense will dehydrate it
  3. OMA-URI :  ./Device/Vendor/MSFT/Policy/Config/Storage/ConfigStorageSenseCloudContentDehydrationThreshold
  4. Data Type : Select Integer
  5. Value : 30

Storage Sense - Intune CSP - 04

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.

  1. Name : ConfigStorageSenseDownloadsCleanupThreshold
  2. Description : Minimum age threshold (in days) of a file in the Downloads folder before Storage Sense will delete it
  3. OMA-URI :  ./Device/Vendor/MSFT/Policy/Config/Storage/ConfigStorageSenseDownloadsCleanupThreshold
  4. Data Type : Select Integer
  5. Value : 90

Storage Sense - Intune CSP - 05

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.

  1. Name : ConfigStorageSenseRecycleBinCleanupThreshold
  2. Description : Minimum age threshold (in days) of a file in the Recycle Bin before Storage Sense will delete it
  3. OMA-URI :  ./Device/Vendor/MSFT/Policy/Config/Storage/ConfigStorageSenseRecycleBinCleanupThreshold
  4. Data Type : Select Integer
  5. Value : 7

Storage Sense - Intune CSP - 06

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.

  1. Name : ConfigStorageSenseGlobalCadence
  2. Description : Storage Sense cadence
  3. OMA-URI :  ./Device/Vendor/MSFT/Policy/Config/Storage/ConfigStorageSenseGlobalCadence
  4. Data Type : Select Integer
  5. Value : 7

Storage Sense - Intune CSP - 07

Then you have a complete policy for Storage Sense that you can apply to your end user.

Storage Sense - Intune CSP - 08

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.

Storage Sense - UX - 01


Read more:

Policy CSP – Storage
What’s new in Storage Sense?