Hyper-V, Hyper-V v2, References, Server 2008 R2, Virtualization, Windows
comments 3

Enabling a captured VHD to boot in a Hyper-V Virtual Machine

In an earlier post, I wrote about how you can use WAIK tools to capture OS image from install.WIM in to a VHD. However, when we connect this VHD directly to a VM in Hyper-V environment, it simply won’t boot because there is no Boot Configuration Data within the VHD. Now, to be able to use this VHD in a Hyper-V VM, we need complete a few more steps.

We need to make the primary partition within the VHD “active”. To do this

  • Open Diskpart
  • Select vdisk file=C:\<VHDFILENAME>.VHD
  • Attach Vdisk
  • select part 1
  • active
  • Assign letter=Z
  • exit
  • Now, at the command prompt, change to Z:\Windows\System32
  • Run, BCDboot.exe Z:\Windows /s Z:\
  • Run, BCDedit /store Z:\boot\BCD /set {bootmgr} device boot
  • Run, BCDedit /store Z:\boot\BCD /set {default} device boot
  • Run, BCDedit /store Z:\boot\BCD /set {default} osdevice boot
  • Change directory to C:\
  • open Diskpart again and run
  • Select vdisk file=C:\<VHDFILENAME>.VHD
  • detach vDISK
  • Exit

Now, create a new virtual machine within Hyper-V and connect this VHD to it. When you start this virtual machine, Windows OS gets installed (or Configured ??).

Filed under: Hyper-V, Hyper-V v2, References, Server 2008 R2, Virtualization, Windows

by

Ravikanth is a principal engineer and the lead architect for Microsoft and VMware virtualized and hybrid cloud solutions within the Infrastructure Solutions Group at Dell EMC. He is a multi-year recipient of Microsoft Most Valuable Professional (MVP) award in Windows PowerShell (CDM) and Microsoft Azure. Ravikanth is the author of Windows PowerShell Desired State Configuration Revealed (Apress) and leads Bangalore PowerShell and Bangalore IT Pro user groups. He can be seen speaking regularly at local user group events and conferences in India and abroad.