I’ve found that maintaining storage usage on a Remote Desktop Session Host (RDSH) has always been a challenge as there can be so many ways a user would inadvertently fill up the storage if items such as profile management and folder redirection is not configured to safely manage disk space usage. One of the clients I’ve been working with saw an increase in storage consumption on their Citrix shared desktop servers after moving the entire organization to work from home. This did not come to a surprise but the original design was not meant to accommodate the change so we began reviewing the additional policies we could apply to these Windows Server 2019 shared desktops published through Citrix.
One of the components we noticed that had increased growth was the recycling bin. Many of the users did not have the habit of purging the items so we had to determine a way of cleaning out the items. The immediate ideas were:
- Disable the recycle bin as the previous Citrix XenDesktop and VMware Horizon View optimization scripts did
- Configure a logoff script that emptied the recycle bin upon logging off for the user
- Educate the users to manually purge them
None of the above ideas were ones we wanted to adopt so we looked into whether there was a way to delete the files in the recycle bin after a specified amount of time. What we found to be available is a feature in Windows 10 named Storage Sense as shown in the following screenshots:
Reviewing the shared desktop servers with the Windows Server 2019 operating system showed that this feature was also available without the need to install any additional features. However, the native group policy templates on the domain controllers did not provide the settings found on the Windows 10 operating system:
Computer Configuration > Administrative Templates > System > Storage Sense:
We had restrictions on installing additional policy templates for the Active Directory domain controllers so I decided to use Process Monitor to determine where the configuration registry keys reside and use them to configure the servers. The following is where these registry keys reside:
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionStorageSenseParametersStoragePolicy
The following is a table for the configuration mappings:
Setting | Name | Type | Data |
Enabling Storage Sense | 01 | REG_DWORD | 1 – Enable
0 – Disable |
Delete temporary files that my apps aren’t using | 04 | REG_DWORD | 1 – Enable
0 – Disable |
Delete files in my recycle bin if they have been there for over | 08 | REG_DWORD | 0 – Never
1 – 1 day |
Run Storage Sense | 2048 | REG_DWORD | 1 – Every day
7 – Every week 30 – Every month 0 – During low free disk space |
Delete files in my recycle bin if they have been there for over | 256 | REG_DWORD | 14 – 14 days
30 – 30 days 60 – 60 days |
Delete files in my Downloads folder if they have been there for over | 32 | REG_DWORD | 0 – Never
1 – 1 day |
Delete files in my Downloads folder if they have been there for over | 512 | REG_DWORD | 14 – 14 days
30 – 30 days 60 – 60 days |
The settings we decided on are as follows:
Storage Sense: Enabled
Run Storage Sense: Every month
Delete temporary files that my apps aren’t using: Enabled
Delete files in my recycle bin if they have been there for over: 60 days
Delete files in my Downloads folder if they have not be used for: Never
Setting | Name | Type | Data |
Enabling Storage Sense | 01 | REG_DWORD | 1 |
Delete temporary files that my apps aren’t using | 04 | REG_DWORD | 1 |
Delete files in my recycle bin if they have been there for over | 08 | REG_DWORD | 1 |
Run Storage Sense | 2048 | REG_DWORD | 30 |
Delete files in my recycle bin if they have been there for over | 256 | REG_DWORD | 60 |
Delete files in my Downloads folder if they have been there for over | 32 | REG_DWORD | 0 |
Delete files in my Downloads folder if they have been there for over | 512 | REG_DWORD | 0 |
To apply these registry settings via group policy on the servers, the following GPO with User Configuration were configured:
Here is an example of one of the registry changes:
Key Path: SoftwareMicrosoftWindowsCurrentVersionStorageSenseParametersStoragePolicy
Value name: 01
Value type: REG_DWORD
Value data: 1
Note that as this GPO will be applied to computer objects, namely the Citrix shared desktops, we will need to enable loopback settings as such:
Computer Configuration > Administrative Templates > System > Group Policy > Configure user Group Policy loopback processing mode
Enabled / Merge
Link the GPO to the OU that contains the shared desktop computer object, run gpupdate /force and you verify that the settings are applied.
2 Responses
i don't see the template as storage sense under system tray in my domain controller while creating a GPO, however
i can do the same via registry is there any way i can get the the storage sense option in my DC and simply configure the same as a GPO from there besides of going with registry setup?
Why not just update the central domain policy repository with the new windows 10 templates from here?
https://www.microsoft.com/en-us/download/101445