FSLogix Compact Profiles Feature At Logoff

Microsoft recently released FSLogix Compacting Profile feature that is invoked at user logoff. You can find more information about FSLogix Compact Profile routine here: https://learn.microsoft.com/en-us/fslogix/concepts-vhd-disk-compaction.

While you can enable FSLogix Compact Profile routine function for all session hosts in your AVD environment, there are a few points to be taken into consideration as it increases the log out time for users and also there are some processes that will always trigger if you enable FSLogix Compact Profile feature.

Microsoft also provides an offline Compact PowerShell script that you can run during maintenance window to compact profiles. You can find Offline Compact PowerShell script here: https://github.com/FSLogix/Invoke-FslShrinkDisk

However, the question stands still – do we really need to enable FSLogix Compact profile feature? We really need to understand and evaluate Benefits of allowing FSLogix Compact to invoke at logoff Vs Running compact script offline once a in week during maintenance window.

  • Runs at user Logoff vs Do users Log off? Since FSLogix compact operation will run only at user logoff, are you sure enabling Compact Operation will capture all profiles? It is important to note that not all users initiate a logoff. We have seen users just disconnecting their sessions. So, if a user doesn’t initiate a log off then the FSLogix Compact operation will not run. If Compact feature doesn’t invoke, then there are chances that only 20% of users or less will be touched by FSLogix Compact Operation and rest will be untouched. On the other hand, if we run Compact Script once in a week, we are ensuring to target all users on Profile Shares.
  • Increasing Log out Time for Users: Please note that enabling FSLogix Compact Profile feature will increase the log out time for the user. However, as it is stated on the Microsoft web site that the process will time-out if the compact operation takes longer than 5 minutes and continue from the previous state. So, there is an increase in the log out time for sure. Considering 5 minutes time is acceptable in some situation, however, the FSLogix Compact routine logic will still need to invoke as to understand if the compact is needed and how much time to compact.
  • Profile Sizes: If you really want to enable FSLogix Compact Profile routine feature then evaluate how many users you have in your environment and what’s their “average” profile size. In an AVD environment where the profile size is lesser than 4-5GB then go ahead and enable it as it won’t take much time (it wouldn’t even take 1 minute as those compact commands are faster) and since FSLogix uses APIs (instead of using PowerShell commands) the process is quite faster. However, if the average profile size is larger than 10 GB or so then please do not just enable it unless you evaluate the overall impact (network/disk/storage etc.)
  • Do we continue to use Offline Compact Script? It depends. Most organizations Turns Off session hosts (scheduled policy or as part of auto-scaling) at night-time which, in turn, forcefully disconnects all opened sessions resulting in removing locks from VHD files. So, if VM’s are turned off then offline script (when you run during maintenance window) can capture all profiles for compaction (100% result). Note that FSLogix compact runs only at “log off” and users do not log off – they simply disconnect their sessions in most cases.
  • Run Offline Script Once: If you really want to enable FSLogix Compact feature then before enabling always run the offline script once to ensure white space from all production profiles have been removed – This way FSLogix Compact routine logic doesn’t have to spend much time in figuring out how much data need to be adjusted/compacted or whatever. 

Can you enable FSLogix Compact Routine function for specific users?

FSLogix Compact Routine feature is enabled by adding a registry entry on the session host. As per Microsoft documentation the feature needs to be enabled by creating a new registry entry at “HKLM:\Software\FSLogix\Apps” key. As I understand there is no way to enable this feature for specific users.

To enable FSLogix Compact Routine feature, run following command on session hosts:

  • Set-ItemProperty -Path “HKLM:\SOFTWARE\FSLogix\Apps” -Name VHDCompactDisk -PropertyType DWORD -Value 1 -Force

To disable FSLogix Compact Routine feature, run following command on session hosts:

  • Set-ItemProperty -Path “HKLM:\SOFTWARE\FSLogix\Apps” -Name VHDCompactDisk -PropertyType DWORD -Value 1 -Force

Do you enable FSLogix Compact Routine feature for all Session Hosts at once?

We recommend enabling it for specific session hosts – let’s say 10 session hosts before enabling it for all session hosts and also take “average” profile size into consideration as explained above.

Where can I download FSLogix Latest release to enable FSLogix Compact Routine?

You can download Public Preview of FSLogix package here

About the Author Nirmal Ratawa