Month: August 2021

Configure Storage Sense in Windows Server 2019

Configure Storage Sense in Windows Server 2019

One of the things I often talk to customers about, is modernizing either an existing or a new Citrix Virtual Apps and Desktops setup. This modernization concept includes a couple of different apps and technologies, one of these apps is Microsoft OneDrive with Known Folder Move and File on Demand.

Microsoft OneDrive should be a well known technology for anyone working in IT, so no further introduction should be necessary. Currently I still have to explain what the Know Folder Move and File on Demand features are as some people are still not familiar with these features.

A few months back I penned an article about how to bury the last remnants of Folder Redirection, this article can be found here. The article contains an overview of how Known Folder Move works and how to enable it both manually and automatically, I recommend going through at least the bullet about Microsoft Know Folder Move, so you have a general idea about the feature.

The Files on Demand feature was introduced in Windows 10 v1709, so the feature has been around for quite some time. Before Files On-Demand, OneDrive had to download and cache everything locally which would usually consume a great deal of disk space. With Files On-Demand it’s only opened/edited files that are downloaded, everything else stays in the cloud. In most cases this means that OneDrive will not use up as much local storage.
You will have to be on Windows Server 2019 to get the Files on Demand feature, the feature is not available in Windows Server 2016 or older.

Manual Configuration

If you allow it, the user is able to configure Storage Sense manually. This is done in the Windows Settings App. Go to System -> Storage you should end up here:

Move the little slider from Off to On:

That’s the default enabled configuration. To do some more advanced configuration click the “Change how we free up space automatically” text:

There really aren’t that many configuration options here. You are able to configure how often Storage Sense should run, whether files in the Recycle Bin and Downloads folders are deleted after a certain amount of time. With OneDrive configured, Storage Sense can delete files in the local OneDrive cache that haven’t been touched within a certain amount of time, this will keep the local cached content to a minimum. Keep in mind that Storage Sense does not delete content that has been flagged as “Always keep on this device”.

But, do you really want you users to configure this manually? Probably not. Most user’s have no idea of what all this means so they shouldn’t really be bothered.

Automatic Configuration

I expect you are configuring OneDrive automatically, most likely via GPO. You should also configure Storage Sense automatically then, however this it’s not possible to configure Storage Sense via GPO in Windows Server 2019, the group policies for Storage Sense do not apply.
Storage Sense group policy support was added in Windows 10 v1903, so with any Windows version before v1903 it’s not possible to configure Storage Sense via GPO. As you probably know Windows Server 2019 is based on Windows version 1809.

Script Configuration

I have created a PowerShell script to setup and configure Storage Sense on a per-user basis. The script is located in one of my GitHub repos. Within the script you’ll find thorough descriptions on the different values you are able to configure via the script, so I will not cover those here.

I prefer to use Citrix WEM to apply this script during the users logon process, as it’s fairly easy to configure the script to apply only to users with OneDrive configured.
I’ll briefly cover how I have configured Citrix WEM to apply the script during logon. I’ll cover how to create an external task, an Action Group and how to assign the Action Group. This will not be an in-depth guide, this assumes you have some basic knowledge of Citrix WEM.

In the Citrix WEM Console create an external task containing the Storage Sense script:

The script obviously has to be available at a location where the users have read access.

Configure an Action Group:

Here I have created an Action Group with OneDrive and the Storage Sense script. I have done a custom install of the OneDrive Sync Client with the built-in auto run disabled, this means that the Citrix WEM agent launches OneDrive automatically for the users who have access to OneDrive and creates a Start Menu shortcut as well.

Assign an action/action group:

All that’s left is to assign the Action Group. As you’ll see I have assigned the action group with a filter called “Application: OneDrive” this filter is configured with a specific Active Directory group. This means that any users that are a member of this group will have access to OneDrive, OneDrive is automatically launched and Storage Sense is automatically configured.

Group Policy Configuration

If you are configuring Storage Sense in Windows 10 v1903 or later, you don’t need the Storage Sense script. As mentioned, with Windows 10 v1903 and later Storage Sense can be configured via group policy.

Adjust the necessary policies to match the needs you have for your environment.

This concludes the article. As always feel free to contact me on Twitter or in the World of EUC Slack channel if you have any comments or questions.