Disable VHD Disk Compaction (preview)

Important

VHD Disk Compaction is currently in PREVIEW. Some information relates to prerelease product that may be substantially modified before it's released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

VHD Disk Compaction is enabled by default. In this article, you'll learn how to disable VHD Disk Compaction.

You can disable VHD Disk Compaction using the registry or Group Policy.

Disable VHD Disk Compaction using the Registry

To disable VHD Disk Compaction using the registry, you'll need to set the following registry value:

  • Key: HKLM\SOFTWARE\FSLogix\Apps
  • Value name: VHDCompactDisk
  • Value type: DWORD
  • Value data: 0

You can do this with PowerShell:

  1. Open an elevated PowerShell prompt and run the following commands:

    Set-ItemProperty -Path "HKLM:\SOFTWARE\FSLogix\Apps" -Name VHDCompactDisk -PropertyType DWORD -Value 0 -Force
    
  2. Restart the computer.

Tip

To enable VHD Disk Compaction again, set the value data to 1, or delete the VHDCompactDisk value .

Disable VHD Disk Compaction using Group Policy

To disable VHD Disk Compaction using Group Policy, first you'll need to add the FSLogix Group Policy administrative template. To configure the template:

  1. Depending on whether you want to configure Group Policy centrally from your domain or locally on each computer:

    • To configure it from an AD Domain, open the Group Policy Management Console (GPMC) and create or edit a policy that targets your computers.

    • To configure it locally, open the Local Group Policy Editor on the computer.

  2. Go to Computer Configuration > [Policies] > Administrative Templates > FSLogix.

  3. Open the policy setting Disk Compaction and set it to Enabled, then for the option Disk Compaction make sure the box is unchecked.

    A screenshot of the Disk Compaction Group Policy setting.

  4. Restart the computer.

Next Steps