OneDrive: Use Files On-Demand - with Convenience Options

April 11, 2024
14 min read

OneDrive Files in the Cloud and Available Locally, Always in Sync

The idea of displaying files on the client system but only keeping the content in the cloud was first implemented in Windows 8.1. However, not in its final form. The technology was not properly implemented until Windows 10, version 1710. Microsoft changed the New Technology File System (NTFS) of Windows 10 for this purpose. The status of each file in OneDrive is stored in two additional attributes. This makes it possible to display files with a size of several terabytes in Windows Explorer on a computer with only 128 GB without taking up space. However, this was only possible because the files and their content are stored in the cloud (the leading system!) and only rudimentary data of a file (placeholder) is shown in Windows Explorer on the client. In this article I will also describe the convenience functions, because these automatically tidy up my files without me having to do anything.

Managing Files and Their Locations and Sync with a Group Policy?

After Microsoft created ways to essentially have a placeholder for a file on the user’s machine(s) that is stored in the cloud and is available on demand, it quickly became clear that the task of switching a file between the various options (local, online-only, always available) could not be left to the user. Too complicated, and the user has completely different requirements in the business environment. Microsoft has implemented certain limitations and has provided administrators with several group policies. These policies dictate the usage of the Use OneDrive Files on Demand feature and automate the Configure Storage Sense Cloud Content Dehydration Threshold group policy.

I’ll first start with the attributes in NTFS which control what happens to the respective files. Figure 1 illustrates two of the states displayed in Windows Explorer. Figure 2 shows the online-only state.

  • Local available
  • Always available
  • Online-only
The illustration shows the basic structure of a file, greatly simplified, and the two symbols (local available and always available) that indicate when the file’s availability on the computer.
Figure 1: This image shows the simplified structure, in the bottom left, of the local available or always available states when a file is available on the computer. | Image created by Hans Brender and used with permission. | View Full Size

In a very simplified form, the following information is stored in each file within OneDrive or in the synchronized files of SharePoint document libraries:

  • Filename
  • Extension
  • Image information
  • Creation date
  • Access date
  • Modification date
  • Attributes
  • File size
  • First pointer to content

Filename: This is the name we see when we create a document.

Extension: A number that matches a file type. On a system with Microsoft Office, for example, a Word symbol can be displayed, if Libre Office is installed then the corresponding Libre Office symbol for a text file.

Image information: Info required if the file is in the cloud, and you do not have an internet connection to obtain information about the file.

Creation date, Access date, Modification date: This different date information is required for automatisms (automatic process from Windows) that can automatically do certain things with this file, and these can also be displayed for each file in Explorer.

Attributes: Two attributes are used to display the status of the file (Locally available, Always available, Online-only). You can read more at Learn.Microsoft.com.

File Size: The total size of the file is displayed here, even if it has the status “Online-only.”

The illustration shows the basic illustration, but the pointer to the contents of the file is missing. The Online-only icon is displayed on the left.
Figure 2: The image shows the changed status of a file. Compared to figure 1, you see that the pointer to the content is missing. The file with content is still only in the cloud, represented by the corresponding cloud document icon. | Image created by Hans Brender and used with permission. | View Full Size

First pointer to content.
The first pointer points to the content, or rather to the start of the content. If a file is moved manually or automatically to the Only available in the cloud state, only this pointer is set to NULL. The user can control this themselves; the corresponding context menu in Explorer is: Free up storage space.

The operating system then indicates that additional storage space is accessible on the hard disk. The filename, along with all the previously mentioned details, remains visible in Explorer. However, the actual content can only be fully accessed in the cloud. A double-click downloads the file or content if the Internet is available. And this makes one thing clear: The cloud is the leading system. Not the local device.

In OneDrive, What Is the Difference Between “Local Available” and “Always Available”?

The symbol you see is different and they have different attributes. Until that point, many are able to accurately explain it, but beyond that, it is frequently misconstrued. The states Local available and Always available are identical except for the attributes. However, there is an automatic mechanism in the form of a group policy that automatically creates space on the hard disk if the file is neither Online-only nor Always available. In other words, the automation can only work if the file attributes are set to Local available. The configuration of the automatic process is explained below.

Group Policy Use OneDrive Files On-Demand

The image shows an icon for the group policy Use OneDrive files on demand and the corresponding string ID: FilesOnDemandEnabled in the computer configuration.
Figure 3: Image shows an icon image for the group policy Use OneDrive files on demand and the corresponding string ID: FilesOnDemandEnabled. | Image created by Hans Brender and used with permission. | View Full Size

Here is the summary of this group policy according to Learn.Microsoft.com.

The Use OneDrive Files On-Demand setting allows your organization to control if the functionality is enabled. This feature, which is only available to customers with Windows 10 Fall Creators Update (version 1709 or later), offers several benefits, including the ability to save space on users' computers and minimize the impact of syncing on the network.

If you enable Use OneDrive Files On-Demand, users who have set up the synchronization app will only see placeholders or online-only files in File Explorer by default. The actual file contents are only downloaded when a file is opened. This helps to conserve local storage space as not all files are downloaded automatically.

I strongly recommend that you leave this setting enabled as it helps to maximize the efficiency of storage usage and reduce network load. Read all recommendations for configuring the synchronization app to ensure optimal use.

If you disable Use OneDrive Files On-Demand, the synchronization behavior will change for Windows 10/11 users, and they will no longer be able to benefit from the "Files On-Demand" feature. Synchronization will then behave as for users of earlier Windows versions.

Enabling this policy will set a specific registry key value to 1. This is done under the registry key:

[HKLM\SOFTWARE\Policies\Microsoft\OneDrive]"FilesOnDemandEnabled"=dword:00000001

If this setting is not configured, users have the option to enable or disable the Use OneDrive Files On-Demand option themselves, depending on their individual needs and preferences.

How I Work with the Use Files On-Demand OneDrive Group Policy

If the OneDrive group policy Use Files On-Demand is turned on, files that I need every day or several times a week are manually converted by me to Always Available on the computer that I take with me when I travel, so that I always have the files available locally AND the automatic process that I describe in the next section does not happen and change these to online-only files.

Changing a file to Always Available is a manual process and must be performed by you in Windows Explorer. Select the desired files, right-click, and the context menu will open. Navigate to OneDrive (indicated by the OneDrive icon) and click Always keep on this device. The icon in Windows Explorer will change. However, this only applies to this device! And because you have changed these files manually, they will not be affected by Storage Sense, which I’ll cover next.

Storage Sense

Three group policies (numbered 1-3 in figure 4) are required for the storage optimization of OneDrive. The other three group policies in the figure can contribute to storage optimization in OneDrive, but do not have to be configured. These group policies are also not found in the OneDrive area, but under Administrative Templates -> System -> Storage Sense of the local Group Policy Editor.

ALT: The figure shows six group policies from the storage optimization area.
Figure 4: This image shows six group policies from the Storage Sense optimization section of the Local Group Policy Editor. Three of these are needed to activate the automatic cleanup function. | Image created by Hans Brender and used with permission. | View Full Size

Storage Sense can automatically clean up some of the user's files to free up storage space. By default, storage optimization is automatically enabled when “the computer is running low on disk space” and is set to run whenever the computer is under memory pressure. This cadence can be changed in the storage settings or set with the Configure Storage Sense cadence group policy.

The Group Policies that Control Storage Sense and Storage Optimization

Storage optimization consists of six individual group policies, whereby only the first three below are of interest for OneDrive:

  • Allow Storage Sense Global (1)
  • Configure Storage Sense cadence (2)
  • Configure Storage Sense Cloud Content dehydration threshold (3)
  • Configure Storage Downloads cleanup threshold.
  • Allow Storage Sense Temporary Files cleanup.
  • Configure Storage Sense Recycle Bin cleanup threshold

Allow Storage Sense Global

You can read about the Allow Storage Sense Global group policy documentation here.

Storage Sense can automatically clean some of the user's files to free up disk space. By default, 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. This cadence can be changed in Storage settings or set with the Configure Storage Sense cadence group policy.

Normally you find that under Windows settings: System - Storage

For me, this is the global switch that needs to be turned on.

Enabled: Storage Sense is turned on for the machine, with the default cadence as “during low free disk space.” Users can't disable Storage Sense, but they can adjust the cadence (unless you also configure the Configure Storage Sense cadence group policy).
Incidentally, I cannot find a value for "Free disk space" when I search for it. This value is adjusted by Microsoft itself.

Disabled: Storage Sense is turned off for the machine. Users can't enable Storage Sense.

Not configured: By default, Storage Sense is turned off until the user runs into low disk space, or the user enables it manually. Users can configure this setting in Storage settings.

Configure Storage Sense Cadence

You can read the Configure Storage Sense cadence group policy documentation here.

Storage Sense can automatically clean some of the user's files to free up disk space.

If the Allow Storage Sense group policy is disabled, then the Configure Storage Sense cadence policy doesn't have any effect.

Enabled: If you enable this group policy, you must set the desired Storage Sense cadence. Supported options are daily, weekly, monthly, and during low free disk space. The default is 0 (during low free disk space).

Disabled or Not Configured: By default, the Storage Sense cadence is set to "during low free disk space." Users can configure this setting in the Storage settings of Windows.

Use the following integer values for the supported options:

  • 0: During low free disk space (default)
  • 1: Daily
  • 7: Weekly
  • 30: Monthly

Configure Storage Sense Cloud Content Dehydration Threshold

You can read the Configure Storage Sense Cloud Content group policy documentation here.

When Storage Sense runs, it can delete files in the user's Downloads folder if they haven't been opened for more than a certain number of days.

If the group policy Allow Storage Sense Global is disabled, then this policy doesn't have any effect.

Enabled: You must provide the minimum number of days a file can remain unopened before Storage Sense deletes it from Downloads folder. Supported values are: 0 - 365.

If you set this value to zero, Storage Sense won't delete files in the user's Downloads folder. The default is 0, or never deleting files in the Downloads folder.

Disabled or Not Configured: By default, Storage Sense won't delete files in the user's Downloads folder. Users can configure this setting in the Storage settings of Windows.

Here Are My Storage Sense Settings on All Devices

  • Allow Storage Sense Global: Enabled
  • Configure Storage Sense cadence: daily
  • Configure Storage Sense Cloud Content dehydration threshold: 3

I mentioned in figure 4 that there are three additional group policies, Configure Storage Downloads cleanup threshold, Allow Storage Sense Temporary Files cleanup and Configure Storage Sense Recycle Bin cleanup threshold. I have only activated the second one, deletion of temporary files, because I want to decide for myself when to delete files in the Windows Recycle Bin and the Download folder area.

What is deleted in the temporary files? There temporary setup files:

  • Old indexed content
  • System cache files
  • Internet cache files
  • Device driver packages
  • Program files downloaded from the system
  • Dated system log files
  • System error memory dump files
  • System error minidump files
  • Temporary system files
  • Dated temporary Windows update files

Summary of Storage Optimization on My Devices

Every day (daily), a check is made to see whether there are files on my synchronized areas that have the status Local available AND have not been opened for three (3) days. I let the group policies then convert these files to the state Files on Demand.

All files that have the status "Always available" are not touched. In addition, temporary files on the system are deleted.

At Microsoft Ignite in 2019 in Orlando, I gave a short 20-minute presentation to a completely packed movie theater, and I showed the image in figure 5 of the top ten of my OneDrive group policies:

The figure shows my top ten group policies from my presentation at Microsoft Ignite 2019 in Orlando.
Figure 5: A slide that shows my top ten group policies for OneDrive from my presentation at Microsoft Ignite 2019. | Image created by Hans Brender and used with permission. | View Full Size

Remarks: These 10 group policy settings were the best for me. Apart from KFM (Known Folder Move), these group policies are still actively available for me. However, my configuration is not comparable to most, because I use four business accounts that are synchronized. Also, I have always used OneDrive to its full potential, even without KFM.

You may have to choose a different setting. If, for whatever reason, you have reduced the OneDrive storage, then it may be necessary to reduce the cadence time to one per day. How would your OneDrive storage be reduced? I can think of two scenarios. If your organization has an E5 plan, that comes with 5 TB of OneDrive storage, some admins want to reduce that to 1 TB for all tenants. OR, if you buy a new device, you may have an older device that had 1 TB of storage, but new machines may come with just 256 MB. With Storage Sense you may work with that depending on the number of files you sync and the size of those files.

If you activate the two other deletion group policies (recycle bin and download folder), don't forget to inform your users of this.

There may be configurations (Citrix, Windows Server) where memory optimization is not available. There is a workaround for this too:

The different file states, Local available, Always available and Online-only are controlled via attributes of the NTFS, so theoretically you can make a change with a CMD console using the attribute command, as shown in the column on the right in figure 6.

The figure shows an overview of the three statuses and another option for making changes using a command line and the attribute command.
Figure 6: This slide shows an overview of the different statuses during synchronization and another option for making changes using a command line and the attribute command. | Image created by Hans Brender and used with permission. | View Full Size


The right half of figure 6 shows three examples of how I can convert a file from one state to another using a CMD command. Of course, you can also use PowerShell to change these attributes and in the example below, all "Local available" files are converted in OneDrive for Business to "Online-only". However, it only does this for the OneDrive area. Files from SharePoint libraries are not considered, nor are other OneDrive Business files. But in principle, the PowerShell code works:

get-childitem $ENV:OneDriveCommercial -Force -File -Recurse -ErrorAction SilentlyContinue |
Where-Object {$_.Attributes -match 'ReparsePoint' } |
ForEach-Object {
attrib.exe $_.fullname +U -P /s
}

Thank you to Tristan Tyson from the UK for posting this PowerShell script for the community. His page with the script also describes these basics.

Storage optimization as an optimal addition to OneDrive solves the problem that your users:

  • get too little storage space on their local hard disks.
  • smaller hard disks can be used on new devices.

But one thing is certain: Your users must be familiarized with the different symbols. Training is essential here. You should test any sync settings that you want to change with a few power users in advance before you roll out the Group Policies to all M365 tenant users.

Links

Other OneDrive group policy articles on TekkiGurus

Hans Brender

Hans Brender

Hans Brender is a Collaboration Specialist and has been a Most Valuable Professional (MVP) in Germany for 11 years. Most people around the world know him as Mr. OneDrive. For the last 11 years he has been talking about OneDrive and collaboration around the world at conferences like Microsoft Ignite, Microsoft Build and local community events. These days he is networking, mentoring, leads a monthly live show about M365 news and gives workshops to the community, mid-size- and Enterprise companies.

In addition to the social profiles below, you can find Hans at: @hansbrender.bsky.social