Go to ...

RSS Feed

June 24, 2022

Native boot VHD – Dual boot made easy!

The easiest, most convenient method to use different versions and editions of Windows 10 in dual or multi boot scenario is through a native boot virtual hard disk. No partitioning or virtualization is required: just create a VHD, install Windows on it, and when done and it’s no longer needed, delete the VHD file.

This kind of thing is ideally suited to test Windows Insider builds, where the computer is running the latest official version of Windows 10, and you install an Insider build onto a VHD and add it to your boot menu.

Compared to a virtual machine, native boot VHD is faster. Instead of emulated virtual devices, it uses the host computer’s physical devices. It acts and behaves exactly as if it were a real physical installation.

Deploy to VHD

Scripting the deployment makes it easy. I use a DISKPART script to create the VHD and partition it, then a batch file to run DISKPART, deploy Windows and add it to the host boot menu. In the title image above you can see my current boot menu, physical installation as default OS, and both Finnish and Swedish Insider previews installed on respective VHD files.

In this post, I will add an English Insider preview as a native boot VHD.

First, here’s the DISKPART script:

create vdisk file=F:\VHD_Store\W10PROIPx64EN-GB.vhdx maximum=51200 type=expandable
attach vdisk
create part primary
format quick label="Windows"
assign letter=W

Although my host machine is a GPT partitioned UEFI system, there are no benefits in partitioning the VHD as a GPT disk. The above script makes a dynamically expanding 50 GB MBR VHD in F:\VHD_Store folder, assigns it a temporary drive letter W and mounts it. Notice that to use VHD in native boot, it must be a VHDX file with extension .vhdx. Although the extension .vhd is also valid extension for a VHD file, it can’t be used for native boot. I save the script as normal text file %userprofile%\Scripts\VHDConf.txt.

Next, here’s the batch file that does the real magic:

start /wait diskpart /s %userprofile%\Scripts\VHDConf.txt
start /wait dism /apply-image /imagefile:J:\sources\install.wim /index:1 /applydir:W:\
start /wait bcdboot W:\Windows
start /wait bcdedit /set {default} description "W10 PRO IP x64 EN-GB (VHD)"
@echo off
echo Windows deployed to VHD file
echo and added to host boot menu.

The /s switch in the first command tells DISKPART to run a script. When it’s done, Insider Preview Windows 10 PRO edition (index 1) will be deployed to VHD from an ISO file mounted as the J: drive. The /applydir drive letter must of course be the same one we assigned in the DISKPART script, W: in this example.

When deployed, Windows on VHD will be added to the host boot menu as the default OS, and it is given a descriptive name.

That’s it! Run the batch file elevated (right click, select Run as administrator). A virtual hard disk will be created and Windows deployed to it.


Prepare the VHD

The VHD will be automatically dismounted when you restart the computer. It doesn’t need to be mounted to boot to it. However, as it still is mounted on the host after we run the batch to deploy Windows, it’s easy to add for instance software installers to it, or add a custom answer file to automate OOBE.

In my case now, I copied some browser offline installers to VHD’s Users\Public\Downloads folder, and my standard answer file to its Windows\Panther folder:

Notice that the folder Windows\Panther does not exist by default, I had to create it and copy my answer file unattend.xml to this folder. When OOBE is run, if an unattend.xml answer file is found in this folder, Windows Setup automatically applies it.

My standard answer file completely automates OOBE, booting straight to desktop. I’ll add the code here, you can copy it and with small modifications use it on your VHD (click expand source to view the code):

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                    <LocalAccount wcm:action="add">
                        <Description>Local admin account</Description>
            <TimeZone>W. Europe Standard Time</TimeZone>
    <settings pass="specialize">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <SupportPhone>+44 123 4567890</SupportPhone>
            <TimeZone>W. Europe Standard time</TimeZone>

Please notice: the preceding answer file sets the Windows language as UK English, and the keyboard layout (InputLocale) as Finnish. Here’s a quote from another Win10.guru guide:

Regional and language settings

InputLocale value, in my case for Finnish keyboard is 040b:0000040b, everything else is set to UK English (SystemLocale, UILanguage, UILanguageFallback, UserLocale). Here’s a short list of some other InputLocale and language codes:

– Brazil – Portuguese > 0416:00000416, pt-BR
– Canada – English > 1009:00000409, en-CA
– Canada – French > 0c0c:00011009, fr-CA
– France – French > 040c:0000040c, fr-FR
– Germany – German > 0407:00000407, de-DE
– UK – English > 0809:00000809, en-GB
– USA – English > 0409:00000409, en-US

Boot to VHD

Restart the computer. The new VHD installation is now shown as default OS. We can change the defaults later, but because OOBE makes a few restarts, it’s practical to let it be default for now:

Select it, and let OOBE run. When on its desktop, you can change the boot menu default OS back to your main host OS.

I said earlier that Windows on VHD is exactly the same as any physical installation. Strictly speaking, that is not true: it can’t be upgraded! When a feature upgrade recognizes the device as virtual hard disk, you will see this warning:

Luckily, that’s a minor issue. In the next post, I will show how to work around this limitation. See this post: Native boot VHD – How to upgrade Windows

You might want to see how easy this is. I made this video for Ten Forums almost two years ago, but it’s still valid:

Stay tuned!


[Note added 9/25/2019 for Spiceworld 2019 attendees]  See my post-show follow-up post at edtittel.com for a link to the slide deck based on this article, and some additional explanation about .vhdx files for native boot: SpiceWorld 2019: Native Boot VHDs in Windows 10.

Author: Kari Finn

A former Windows Insider MVP, Kari started in computing in the mid 80’s writing code for VAX / VMS systems. Since then, he’s worked in a variety of IT positions. He specializes in Windows image capture, customization, repair and deployment as well as Hyper-V virtualization. Kari is a proud Team Member at number #1 Windows site TenForums.com.

One Response “Native boot VHD – Dual boot made easy!”

  1. Dave
    October 4, 2020 at 08:06

    Hi Kari could you help with booting a vhdx file on a different hard disk? If I try it gives an error that winload.efi could not be found. I think the bcdedit command has to be modified to use mount point GUID instead of drive letters but I have no idea how to do that.

More Stories From 1903

Magbo Invite Codes Links: