by Marcuz-Apl | 10/05/2023

Table of Contents
Getting Started
Prerequisites
Step 1: Create a VHDX from diskpart
Step 2: Apply a Windows image to the VHDX
Step 3: Add a boot entry
Step 4: Expand, Relocate or Remove the vdisk
The End

Getting Started

Native Boot allows you to create a virtual hard disk (VHDX), install Windows to it, and then boot it up, either on your PC side-by-side with your existing installation, or on a new device.

A native-boot VHDX can be used as the running operating system on designated hardware without any other parent operating system. This differs from a scenario where a VHDX is connected to a virtual machine on a computer that has a parent operating system.

[!NOTE]

Native boot for Windows 10 or later requires the .vhdx format, not the .vhd format.

VHDXs can be applied to PCs or devices that have no other installations of Windows, without a virtual machine or hypervisor. (A hypervisor is a layer of software under the operating system that runs virtual computers.) This enables greater flexibility in workload distribution because a single set of tools can be used to manage images for virtual machines and designated hardware.

You can also deploy the VHDX to a PC that already has Windows installed on it, and use a boot menu to select between the existing version of Windows, or the version on the VHD.

To learn more about using VHDXs in an enterprise environment, see Understanding Virtual Hard Disks with Native Boot.

Prerequisites

  • A technician PC with the Windows Assessment and Deployment Kit (Windows ADK) tools installed on it.
  • A generalized Windows image (.WIM file). To learn more, see Sysprep (Generalize) a Windows installation.
  • A bootable Windows PE drive. To learn more, see WinPE: Create USB Bootable drive.
  • A destination PC or device on which to install the VHDX. This device requires 30 gigabytes (GB) or more of free disk space. You can install the VHDX to a device already running other operating system installations, or as the only operating system on a device.

Step 1: Create a VHDX from diskpart

On the technician PC:

  1. Run the Command Prompt as Administrator, open diskpart.
mkdir C:\VHDs
diskpart
  1. Create and prepare a new VHDX. In this example, we create a 200 GB expandable-type VHDX.
## The rest commands run in diskpart env
create vdisk file=C:\VHDs\win11ent.vhdx maximum=204800 type=expandable
  1. Attach the VHDX. This adds the VHDX as a disk to the storage controller on the host.
attach vdisk
  1. Create a partition for the Windows files, format it, and assign it a drive letter (This drive letter will appear in File Explorer).
create partition primary
format quick label=vhdx
assign letter=v
  1. Exit diskpart env.
## Exit the diskpart env
exit

Step 2: Apply a Windows image to the VHDX

On your technician PC, apply a generalized Windows image to the primary partition of the VHDX that you created and attached in Step 1.

For my case, I use a install.wim from the latest Windows 11 Pro ISO downloaded from Microsoft website.

Firstly get known the inventory list that are contained in the install.wim by:

Dism /Get-ImageInfo /ImageFile:I:\sources\install.wim

And the output belike:

Deployment Image Servicing and Management tool
Version: 10.0.26100.5074

Details for image : I:\sources\install.wim

Index : 1
Name : Windows 11 Enterprise LTSC
Description : Windows 11 Enterprise LTSC
Size : 18,359,746,339 bytes

Index : 2
Name : Windows 11 IoT Enterprise LTSC
Description : Windows 11 IoT Enterprise LTSC
Size : 18,357,158,410 bytes

Index : 3
Name : Windows 11 IoT Enterprise Subscription LTSC
Description : Windows 11 IoT Enterprise Subscription LTSC
Size : 18,357,183,729 bytes

The operation completed successfully.

My targeting index is 2 - Windows 11 IoT Enterprise LTSC, so here is the command to apply the image to my virtual disk:

Dism /Apply-Image /ImageFile:I:\sources\install.wim /index:2 /ApplyDir:V:\

Since this is a big image, it takes quite a while to process, a progress bar of how much has finished will be presented.

Step 3: Add a boot entry

  1. Add a boot entry of the VHDX device to the Running Windows 11. Obviously, you can add multiple VHDX files.

UEFI:

C:\
cd C:\Windows\System32
bcdboot V:\windows
## bcdboot V:\Windows /s C: /f UEFI

the output belike:

Boot files successfully created.

BIOS:

C:
cd C:\Windows\System32
bcdboot V:\Windows /s C: /f BIOS
  1. Unmount the Drive V:
diskpart

## The rest commands run in diskpart env
list volume
select volume 11
remove letter V
## Exit the diskpart env
exit
  1. Last mark-up: change the description of the Windows 11/10 systems we just installed using bcdedit.
## list the bootable systems via Windows Boot Manager
bcdedit /enum

Th output belike:

Windows Boot Manager
--------------------
identifier              {bootmgr}
device                  partition=\Device\HarddiskVolume1
path                    \EFI\Microsoft\Boot\bootmgfw.efi
description             Windows Boot Manager
locale                  en-us
inherit                 {globalsettings}
default                 {default}
resumeobject            {5670fc34-99a7-11f0-82af-9ab4522a2acf}
displayorder            {default}
                        {current}
toolsdisplayorder       {memdiag}
timeout                 30

Windows Boot Loader
-------------------
identifier              {default}
device                  partition=V:
path                    \Windows\system32\winload.efi
description             Windows 11
locale                  en-us
inherit                 {bootloadersettings}
isolatedcontext         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=V:
systemroot              \Windows
resumeobject            {5670fc34-99a7-11f0-82af-9ab4522a2acf}
nx                      OptIn
bootmenupolicy          Standard

Windows Boot Loader
-------------------
identifier              {current}
device                  partition=C:
path                    \WINDOWS\system32\winload.efi
description             Windows 11
locale                  en-US
inherit                 {bootloadersettings}
recoverysequence        {5670fc31-99a7-11f0-82af-9ab4522a2acf}
displaymessageoverride  Recovery
recoveryenabled         Yes
isolatedcontext         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=C:
systemroot              \WINDOWS
resumeobject            {5670fc2f-99a7-11f0-82af-9ab4522a2acf}
nx                      OptIn
bootmenupolicy          Standard
hypervisorlaunchtype    Auto
💡
[!NOTE]

Obviously,

1- There is one Windows Boot Manager to manage 2 Windows Boot Loader.

2- The Windows Boot Manager is currently referring to the OS with identifier of {current}, while the newly-added, VHDX-based Windows 11 has an identifier of {default}, then, we need to rename the identifier of VHDX file.
  1. Critical Operation to rename the identifier:
# Display the details
bcdedit /enum /v
# Copy the GUID to replace {default} identifier and update the description
bcdedit /copy {default} /d "Windows 11 VHDX"
# Note down the GUID of the VHDX: {5670fc36-99a7-11f0-82af-9ab4522a2acf}
bcdedit /enum
  1. Critical Operation to specify the device and osdevice:
# Set the `device` path of the VHDX file against the GUID
bcdedit /set {5670fc36-99a7-11f0-82af-9ab4522a2acf} device vhd=[C:]\VHDs\win11Ent.vhdx

# Set the `osdevice` option to point to the same VHDX file path, which specifies the OS location
bcdedit /set {5670fc36-99a7-11f0-82af-9ab4522a2acf} osdevice vhd=[C:]\VHDs\win11Ent.vhdx

## (Optional) Set option to ensure hardware detection
bcdedit /set {5670fc36-99a7-11f0-82af-9ab4522a2acf} detecthal on

## (Optional) Set this new VHDX entry as the default boot option
bcdedit /default {5670fc36-99a7-11f0-82af-9ab4522a2acf}

## take a look at what we have now
bcdedit /enum

Here are the outputs:

Windows Boot Manager
--------------------
identifier              {bootmgr}
device                  partition=\Device\HarddiskVolume1
path                    \EFI\Microsoft\Boot\bootmgfw.efi
description             Windows Boot Manager
locale                  en-us
inherit                 {globalsettings}
resumeobject            {5670fc34-99a7-11f0-82af-9ab4522a2acf}
displayorder            {current}
                        {5670fc36-99a7-11f0-82af-9ab4522a2acf}
toolsdisplayorder       {memdiag}
timeout                 30

Windows Boot Loader
-------------------
identifier              {current}
device                  partition=C:
path                    \WINDOWS\system32\winload.efi
description             Windows 11
locale                  en-US
inherit                 {bootloadersettings}
recoverysequence        {5670fc31-99a7-11f0-82af-9ab4522a2acf}
displaymessageoverride  Recovery
recoveryenabled         Yes
isolatedcontext         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=C:
systemroot              \WINDOWS
resumeobject            {5670fc2f-99a7-11f0-82af-9ab4522a2acf}
nx                      OptIn
bootmenupolicy          Standard
hypervisorlaunchtype    Auto

Windows Boot Loader
-------------------
identifier              {5670fc36-99a7-11f0-82af-9ab4522a2acf}
device                  vhd=[C:]\VHDs\win11Ent.vhdx
path                    \Windows\system32\winload.efi
description             Windows 11 VHDX
locale                  en-us
inherit                 {bootloadersettings}
isolatedcontext         Yes
allowedinmemorysettings 0x15000075
osdevice                vhd=[C:]\VHDs\win11Ent.vhdx
systemroot              \Windows
resumeobject            {5670fc34-99a7-11f0-82af-9ab4522a2acf}
nx                      OptIn
bootmenupolicy          Standard
detecthal               Yes

Please pay attention to the description, device and osdevice values of the new boot entry.

  1. Restart the destination PC.

If there's only one boot entry, the device immediately boots to Windows. If there's more than one boot entry, you'll see a boot menu where you can choose between the available versions of Windows on the device.

💡
identifier GUID vs. resumeobject GUID

Yes, the BCDEDIT identifier GUID is different from the resumeobject GUID because they serve different purposes: the identifier GUID is a unique name for a boot entry, while the resumeobject GUID is used by the Windows resume application to identify the resume object in the BCD store. The identifier GUID is what bcdedit uses to manage boot entries, while the resumeobject GUID is specific to the resume application itself.

identifier GUID

  • Purpose: Uniquely identifies a specific entry in the Boot Configuration Data (BCD) store, such as the Windows Boot Manager or a specific operating system loader.
  • Format: A standard Globally Unique Identifier (GUID) like {7fe1704c-d675-11ea-942e-50eb710eeb05}.
  • Usage: You use the identifier GUID to perform commands on a specific entry, such as bcdedit /set {identifier_GUID} ....
  • Well-known identifiers: Instead of a GUID, you can often use a reserved identifier like {current} for the current boot entry or {bootmgr} for the boot manager itself.

resumeobject GUID

  • Purpose: A specific GUID used by the "Windows Resume Application" to identify the correct boot entry for resuming a system from a low-power state.
  • Format: Also a GUID, but its specific function is related to system hibernation and resume functionality.
  • Usage: This GUID is tied to the functionality of resuming from sleep or hibernate, and you would manage it through its specific identifier in the BCD store.

Step 4: Expand, Relocate or Remove the vdisk

Once your VDISK becomes almost full, it's definitely a good time to expand the volume. Run the CMD as Administrator please,

diskpart

## The rest commands run in diskpart env
select vdisk file=C:\VHDX\win11Ent.vhdx
expand vdisk maximum=122880
## Capacity Conversion
## 153600 MB = 150 GB
## 122880 MB = 120 GB
## 102400 MB = 100 GB
## 81920 MB = 80 GB
## 51200 MB = 50 GB
## 30720 MB = 30 GB
attach vdisk
list volume
select volume 8
extend
## Exit the diskpart env
exit

In some cases, you would like to remove the very VHDX off the Boot Entry:

bcdedit /enum
bcdedit /delete {identifier}

If you relocate the .VHDX file to another folder, you can update the "osdevice" and "device" parameters by:

bcdedit /set {5670fc36-99a7-11f0-82af-9ab4522a2acf} osdevice vhd=[E:]\VHDX\win11Ent.vhdx
bcdedit /set {5670fc36-99a7-11f0-82af-9ab4522a2acf} device vhd=[E:]\VHDX\win11Ent.vhdx

The End