← back to blog

Windows 11 VHDX Native Boot

I recently wrote up a light guide after experimenting with using VHDX disks to dual-boot different instances of Windows 11 to test various things without the limitation of working inside of a Hyper-V virtual machine. Maybe this will help someone looking to do the same.


System Requirements

  • Host OS is Windows 11 Pro 20H2 or greater.
  • Hyper-V role/feature is already installed.
  • The volume/partition where the VHDX is to be placed:
    • Is not Bitlocker encrypted.
    • Is not a "dynamic" disk. (software raid/storage spaces)
    • Has greater than 128GB of disk space available.

Build VHDX From Source

  1. Create a temporary working directory. <tempdir>
  2. Build Windows 11 Professional - Latest Public Release script from UUP dump.
  • Select Only Windows Pro edition, remove the selection of Home edition and hit next.
  • At Select your download options, select Download and convert to ISO.
  • Under Conversion Options, select all but "Use solid (ESD) compression".
  • Select Create download package.
  1. Extract UUP download package to <tempdir>.
  2. Run uup_download_windows.cmd in administative CMD shell.
  3. Rename resulting ISO to "win11_pro.iso".
  4. Download Hyper-ConvertImage from PowerShell Gallery.
  5. Extract to <tempdir>.
  6. Append the following to Convert-WindowsImage.ps1
Convert-WindowsImage -SourcePath .\win11_pro.iso -VHDFormat VHDX -SizeBytes 128GB -VHDPath .\Windows11_Pro_x64_Bootable.vhdx -Edition "Windows 11 Pro" -DiskLayout UEFI -BCDinVHD NativeBoot
  1. Run Convert-WindowsImage.ps1
  • Requires Powershell 5 / Incompatible with Powershell 7
  1. Rejoice 🙌, you should now have a working VHDX for native boot within <tempdir> called "Windows11_Pro_x64_Bootable.vhdx".

Setup and Installation

  1. Place VHDX where you want it to live.
  2. Right click the VHDX, mount it and note the drive letter.
  3. Open an administrative command prompt.
  4. Create new boot entry:
    • Command: bcdboot <drive letter>:\Windows
    • Example: bcdboot F:\Windows
  5. Get GUID for new entry:
    • Command: bcdedit /v
    • Pull identifier GUID for entry with device of vhd=[<driveletter>:]\
  6. Rename new entry:
    • Command: bcdedit /set <identifier> description "Windows 11 – VHDX Boot"
    • Example: bcdedit /set {bd67a0a8-a586-11e6-bf4e-bc8385086e7d} description "Windows 11 PTIT – VHDX"
  7. Check if Hyper-V extensions are still enabled:
    • Command: bcdedit /v
    • Check for hypervisorlaunchtype auto under non VHDX entry.
      • If not present, run: bcdedit /set hypervisorlaunchtype auto
  8. Set Default Boot Entry:
    1. Command msconfig
    2. Within "System Configuration" window, select "Boot" tab.
    3. Highlight which entry you would like to boot after 30 seconds/upon timeout.
    4. Select "Set as default"
    5. Click OK and exit "System Configuration".
    6. Select "Exit Without Restart" if prompted.
  9. Reboot when ready and select new entry when prompted during boot process.
    • It is normal and expected that you will have to select this twice. The VM has been built to be generic and will attempt to load appropriate drivers upon first boot then immediately reboot to OOBE on the second try.
  10. Proceed with going through OOBE and setting up VM.

Uninstallation

  1. Boot to host OS.
  2. Open "System Configuration" via msconfig command.
  3. Select the "Boot" tab.
  4. Highlight the entry you created during "Setup and Installation".
    • This entry should end in (\Windows) (without a drive letter).
  5. Click "Delete".
  6. Click "OK" to exit the menu.
  7. Delete the VHDX if desired.

Issues

"Performance Options" Dialog On Every Boot

If you see a "Performance Options" dialog window on every boot to desktop, or are unable to configure a pagefile, the below will configure a floating pagefile on the unencrypted host volume.

  1. Click "Change" within "Performance Options" dialog window.
    • If you already closed the dialog:
      1. Open the Settings app.
      2. Click System.
      3. Click the "Advanced system settings" link.
      4. Click the "Advanced" tab.
      5. Select the "Settings" button in "Performance" section.
  2. Check "Automatically manage paging file size for all drives".
  3. Select OK to close "Virtual Memory" dialog.
  4. Select OK to close "Performance Options" dialog.
  5. Open regedit as admin.
  6. Browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\
  7. Edit PagefileOnOsVolume DWORD entry to 0
  8. Delete TempPageFile DWORD entry if present.
  9. Reboot.

Dismounting VHDX Storage Volume

If the Native Boot VM has enforcement of Bitlocker encryption via something such as Intune, the automatically mounted volume where the VHDX is stored must be dismounted to meet compliance.

  1. Open Disk Management diskmgmt.msc
  2. Right-click volume where VHDX is stored.
    • Do not select the C: volume!
  3. Select "Change Drive Letter and Paths"
  4. Select "Remove" and click "OK"
  5. A warning popup will appear "Some programs that rely on drive letters... sure you want to remove this drive letter?", Select "Yes"

Poor WSL2 Performance

Due to running within a mounted VHDX, the 9P filesystem protocol used by WSL2 suffers from instability/extremely poor performance. The emulated filesystem of WSL1 is not impacted. To convert an installed distro to WSL1, the following command can be utilized:

wsl --set-version <distroname> 1