Profile Management

Configure VHD settings

Profile Management provides the following VHDX-based features:

This article shows you how to customize and optimize VHDX-based features:

Specify the storage capacity and path for VHD containers

By default, each VHDX container is stored in the user store with a disk capacity of 50 GB. If needed, you can choose a different storage path for it and change its default capacity.

The following table lists the default and custom storage paths of VHDX files.

Policy Default storage path Custom storage path
Profile container settings
Outlook search index roaming
Accelerate folder mirroring
Enable OneDrive container
Enable UWP apps roaming
{USER_STORE_PATH}\ProfileContainer\{OS_NAME_SHORT}\
{USER_STORE_PATH}\VHD\{OS_NAME_SHORT}\
{USER_STORE_PATH}\MirrorFolders\
{USER_STORE_PATH}\OneDrive\
{USER_STORE_PATH}\AppStore\
{VHDX_STORE_PATH}\ProfileContainer{OS_NAME_SHORT}
{VHDX_STORE_PATH}\VHD{OS_NAME_SHORT}
{VHDX_STORE_PATH}\MirrorFolders
{VHDX_STORE_PATH}\OneDrive
{VHDX_STORE_PATH}\AppStore

Profile Management now impersonates the current user to access the VHDX files and does not grant Domain Computers full control permission to the storage path of the VHDX files.

Specify the storage path

Prepare a network storage location for the VHDX containers. Make sure that you grant your users Modify permission or higher to the storage location.

Specify the storage path for VHDX containers by following these steps:

  1. Open the Group Policy Management Editor.
  2. Under Computer Configuration > Administrative Templates > Citrix Components > Profile Management > Advanced settings, double-click the Customize storage path for VHDX files policy.
  3. Select Enabled.
  4. In the Path to store VHDX files field, type the full path of the storage location. Example: \\myservername\vhdx_store.
  5. Click Apply, and then click OK.

To enable the setting to take effect, do the following:

  1. Log off from all sessions that are using the user profile.
  2. Run the gpupdate /force command from the command prompt.

    When the policy takes effect varies depending on the use cases:

    • If it is the first time you specify a storage path for VHDX files, the policy takes effect after the user logs on.
    • If it is you change the storage path for VHDX files, the policy takes effect after the user logs off for the first time.

For more information about the gpupdate command, see the Microsoft document.

If this setting is not configured here, the value from the .ini file is used. If this setting is not configured here or in the .ini file, Profile Management stores the VHDX files in the user store.

Specify the default storage capacity for a VHD container

Each VHD container has a default storage capacity of 50 GB. To change the capacity, follow these steps:

  1. Open the Group Policy Management Editor.
  2. Under Computer Configuration > Administrative Templates > Citrix Components > Profile Management > Advanced settings, double-click the Default capacity of VHD containers (GB) policy.
  3. Select Enabled.
  4. In the Default capacity (in GB) field, type a new number as needed.
  5. Click OK.

Enable and configure VHD disk compaction settings

VHD disk compaction is a process that reduces the size of a VHD file by removing empty space and combining the data within the file. With the Enable VHD disk compaction policy, you can enable VHD disk compaction for Profile Management. VHD files created by Profile Management are automatically compacted on user logoff when certain conditions are met, thus saving space on central or cloud storage.

This section guides you through enabling VHD disk compaction and adjusting the default compaction settings and behavior.

Overview

VHDX disk compaction applies to the following VHDX files in Profile Management:

With the Enable VHD disk compaction policy enabled, a VHDX file is automatically compacted on user logoff when one of the following conditions is met:

  • The free space ratio of the VHD file exceeds a specified value (by default, 20%)

    Free space ratio = (current VHD file size – required minimum VHD file size*) ÷ current VHD file size

    * Obtained using the GetSupportedSize method of the MSFT_Partition class from the Microsoft Windows operating system. See Get the required minimum size for a VHD file for details.

  • The number of logoffs since the last compaction reaches a specified value (by default, 5)

    Note:

    When a user logs off, the process of compacting VHD disks occurs in parallel with the logoff process. Thus, disk compaction does not prolong logoff time. If the VHD disk compaction process is not complete when the user attempts to log back on, Profile Management prevents the logon attempt.

Depending on your needs and the resources available, you can adjust those default settings using the following policies in Advanced settings:

  • Free space ratio to trigger VHD disk compaction
  • Number of logoffs to trigger VHD disk compaction

When VHD disk compaction is enabled, the VHD disk file is first defragmented using the Windows built-in defrag tool, and then compacted. VHD disk defragmentation produces better compaction results while disabling it can save system resources. If needed, you can disable defragmentation using the following policy in Advanced settings:

  • Disable defragmentation for VHD disk compaction

Enable VHD disk compaction

With VHD disk compaction enabled, you can save storage space consumed by profile container, OneDrive container, and folder mirroring container.

To enable VHD disk compaction using a GPO, follow these steps:

  1. Open the Group Policy Management Editor.
  2. Access Policies > Administrative Templates: Policy definitions (ADMX files) > Citrix Components > Profile Management > Profile Container settings.
  3. Double-click the VHD disk compaction policy.
  4. In the policy window that appears, select Enabled, and then click OK.

The configuration precedence is as follows:

  1. If this setting isn’t configured using a GPO, Studio, or Workspace Environment Management (WEM), the value from the .ini file is used.
  2. If this setting isn’t configured anywhere, the feature is disabled.

Change the compaction settings and behavior

Enabling VHD disk compaction can save storage space, but it also consumes system I/O and network bandwidth. You can monitor the system and network resource usage during the compaction process to determine whether to adjust the following settings:

  • Free space ratio to trigger VHD disk compaction
  • Number of logoffs to trigger VHD disk compaction
  • Disable defragmentation for VHD disk compaction

To change the default compaction settings and behavior using a GPO, follow these steps:

  1. Open the Group Policy Management Editor.
  2. Access Policies > Administrative Templates: Policy definitions (ADMX files) > Citrix Components > Profile Management > Advanced settings.
  3. To change the free space ratio to trigger the compaction, follow these steps:
    1. Double-click the Free space ratio to trigger VHD disk compaction policy.
    2. In the policy window that appears, select Enabled, enter a percentage as needed, and then click OK.
  4. To change the number of logoffs (since the last compact) to trigger the compaction, follow these steps:
    1. Double-click the Number of logoffs to trigger VHD disk compaction policy.
    2. In the policy window that appears, select Enabled, enter a value as needed, and then click OK.
  5. To disable defragmentation for VHD disk compaction, follow these steps:
    1. Double-click the Disable defragmentation for VHD disk compaction policy.
    2. In the policy window that appears, select Enabled, and then click OK.

The configuration precedence is as follows:

  • Free space ratio to trigger VHD disk compaction
    1. If this setting isn’t configured using a GPO, Studio, or WEM, the value from the .ini file is used.
    2. If this setting isn’t configured anywhere, the default value 20 (%) is used.
  • Number of logoffs to trigger VHD disk compaction
    1. If this setting isn’t configured using a GPO, Studio, or WEM, the value from the .ini file is used.
    2. If this setting isn’t configured anywhere, the default value 5 is used.
  • Disable defragmentation for VHD disk compaction
    1. If this setting isn’t configured using a GPO, Studio, or WEM, the value from the .ini file is used.
    2. If this setting isn’t configured anywhere, defragmentation is enabled by default.

Get the required minimum size for a VHD file

Detailed steps are as follows:

  1. Ensure that the VHD file is attached to the operating system.
  2. Run this PowerShell command as an administrator:

    Get-WmiObject -Class MSFT_Partition -Namespace ROOT\Microsoft\Windows\Storage

    All partitions of your current desktop appear.

  3. Locate the partition corresponding to the VHD file, and then get the required minimum size (SizeMin) using the GetSupportedSize method.

Enable exclusive access to VHD containers

Note:

  • This setting applies to OneDrive containers and the profile containers that are enabled for the entire user profile.
  • If this setting is enabled for profile containers, the Enable multi-session write-back for profile containers setting is automatically disabled.

By default, VHD containers allow concurrent access. If needed, you can disable concurrent access for profile containers and OneDrive containers.

Detailed steps are as follows:

  1. Open the Group Policy Management Editor.
  2. Under Computer Configuration > Administrative Templates > Citrix Components > Profile Management > Profile container settings, double-click the Enable exclusive access to VHD containers policy.
  3. Select Enabled.
  4. Select the containers to which you want to enable exclusive access. Options include Profile container and OneDrive container.
  5. Click OK.

To enable the setting to take effect, do the following:

  1. Log off from all sessions that are using the user profile.
  2. Run the gpupdate /force command from the command prompt.

If this policy is not configured here, the value from the .ini file is used. If this policy is not configured either here or in the .ini file, the setting is disabled.

Enable automatic reattachment of VHDX disks in sessions

With the Automatically reattach VHDX disks in sessions feature, Profile Management ensures a high level of stability of VHDX-based policies.

Each VHDX-related policy relies on the relevant VHDX disk to function properly. Profile Management attaches those disks during logons and detaches them during logoffs. However, those VHDX disks might be accidentally detached during a session, preventing the policies from functioning properly. Possible causes for a VHDX disk to be detached include:

  • File server encountering a transient error
  • Slow network connection

With the Automatically reattach VHDX disks in sessions policy enabled, Profile Management monitors VHDX disks that are in use by the preceding VHDX-based policies. If any of the disks is detached, Profile Management reattaches the disk automatically.

Enable the policy

By default, the policy is enabled. We recommend you keep its default setting to ensure the high stability of VHDX-based policies.

If you experience performance issues with the VHDX-based policies, follow these steps to check the policy setting:

  1. Open the Group Policy Management Editor.

  2. Under Citrix Components > Profile Management > Advanced settings, double-click the Automatically reattach VHDX disks in sessions policy.

  3. If the setting is Disabled, select Enabled, and then click OK.

For your changes to take effect, run the gpupdate /force command from the command prompt, as documented in the Microsoft article.

Configuration precedence:

  1. If this policy isn’t configured here, the value from the .ini file is used, which defaults to enabled.
  2. If this setting is not configured either here or in the .ini file, the policy is enabled by default.
Configure VHD settings