Steps To Create Bootable VHD On Hyper-V

Steps to Create Bootable VHD on Hyper-V

In this blog, we will show you the steps to create bootable VHD on Hyper-V which contains a windows image.

REQUIREMENTS

  • Hyper-V Physical Host
  • Windows 2016 ISO image
  • DISM (Deployment Image Servicing and Management)

CREATING VIRTUAL HARD DISK

  • Open the elevated command prompt window.
Steps to Create Bootable VHD on Hyper-V
  • Type the command diskpart and press Enter.
Steps to Create Bootable VHD on Hyper-V
  • Type the below command to create a VHD file with disk space. In this demo, we are creating a VHD file named winboot.vhd with 25 GB of disk space.

create vdisk file=e:\vhd\winboot.vhd maximum=25000 type=expandable

Steps to Create Bootable VHD on Hyper-V
  • Select the virtual disk.

select vdisk file=e:\vhd\winboot.vhd

Steps to Create Bootable VHD on Hyper-V
  • Attach the newly created disk.

attach vdisk

Steps to Create Bootable VHD on Hyper-V
  • Create a primary Partition in the virtual disk.

create partition primary

Steps to Create Bootable VHD on Hyper-V
  • Assign a Drive Letter. In this demo, we are assigning the driver letter as V.

assign letter=v

Steps to Create Bootable VHD on Hyper-V
  • Make the partition as ACTIVE
Steps to Create Bootable VHD on Hyper-V
  • Format the VHD.

format quick FS=NTFS Label=VHD

Steps to Create Bootable VHD on Hyper-V
  • Type exit command to quit diskpart.
Steps to Create Bootable VHD on Hyper-V

APPLY WINDOWS IMAGE TO VHD THROUGH DISM

Note: We are using Windows Server 2016 image in this demo

  • We have mounted the windows 2016 image in D:\ drive.
Steps to Create Bootable VHD on Hyper-V
  • Open the elevated command prompt window.
Steps to Create Bootable VHD on Hyper-V
  • Execute the below command to view the OS version and edition from install.wim file.

dism /Get-WimInfo /wimfile:d:\sources\install.wim

Steps to Create Bootable VHD on Hyper-V
  • We are applying Windows Server 2016 Datacenter Evaluation edition-Desktop Experience    (Index 4). Run the Apply-Image command through DISM Management.

dism /apply-image /imagefile:d:\sources\install.wim /index:4 /applydir:v:\

Steps to Create Bootable VHD on Hyper-V
  • We have already mounted the VHD in V:\ drive. It will take several minutes to complete the action.
Steps to Create Bootable VHD on Hyper-V
Steps to Create Bootable VHD on Hyper-V

PREPARING VHD TO BOOT AS VIRTUAL MACHINE

  • Open the elevated command prompt window.
Steps to Create Bootable VHD on Hyper-V
  • To create the BCD entry for native VHD boot, type the below command.

V:\windows\system32\bcdboot V:\windows /s V:

Steps to Create Bootable VHD on Hyper-V
  • BCDboot creates boot configuration entry so that windows bootloader can boot from the VHD.
  • Run the bcdedit command to view the system boot configuration information
Steps to Create Bootable VHD on Hyper-V
  • Type exit command to close the command prompt window.
  • Eject the VHD through windows explorer
Steps to Create Bootable VHD on Hyper-V

ADDING THE VHD TO A VM IN HYPER-V

  • Open the Hyper-V Snap-in. Right Click on the server name and select New – Virtual Machine.
Steps to Create Bootable VHD on Hyper-V
  • From the new virtual machine wizard welcome screen, Click Next.
Steps to Create Bootable VHD on Hyper-V
  • Provide a name for the virtual machine and click Next.
Steps to Create Bootable VHD on Hyper-V
  • Select the Generation type and click Next.
Steps to Create Bootable VHD on Hyper-V
  • Specify the memory size and Click Next.
Steps to Create Bootable VHD on Hyper-V
  • Specify the Network adapter from the drop-down list and click Next.
Steps to Create Bootable VHD on Hyper-V
  • Select the Use an existing Virtual Hard disk option and click on browse.
Steps to Create Bootable VHD on Hyper-V
  • Select the winboot.vhd file from E:\VHD folder and click Open.
Steps to Create Bootable VHD on Hyper-V
  • Once the VHD name is shown in the location path. Click Next.
Steps to Create Bootable VHD on Hyper-V
  • Click on Finish button to complete the wizard.
Steps to Create Bootable VHD on Hyper-V

TESTING THE VM

  • Now spin up the VM through Hyper-V manager. If the VM is properly configured, it will boot and prompt for Region & Language Selection. Provide the required information and click Next.
Steps to Create Bootable VHD on Hyper-V
  • Click on Accept button to accept the Windows license agreement.
Steps to Create Bootable VHD on Hyper-V
  • Provide the password for the administrator account and click finish to complete the configuration window.
Steps to Create Bootable VHD on Hyper-V
  • You will able to view the windows login screen.
Steps to Create Bootable VHD on Hyper-V

VIDEO

Thanks for reading this blog. We hope it was useful for you to learn the steps to create bootable VHD Image for Hyper-V VM’s.

Loges