Saturday, 21 September 2013

Converting a WIM file to VHD on a UEFI system

I always use the excellent Convert-WindowsImage.ps1 script by Mike Kolitz for taking the WIM files from the Windows media and converting them into bootable VHD files.  It's the quickest and easiest way for creating VM Templates in SCVMM.

The script can be found here: http://gallery.technet.microsoft.com/scriptcenter/Convert-WindowsImageps1-0fe23a8f/

However, I ran into a problem today with the script throwing an error about "Could not get the BootMgr object from the Virtual Disks BCDStore"


It turns out from a couple of replies in the discussion thread of the TechNet Gallery listing that this will generally happen if trying to run the script from a device that uses UEFI to boot, which I happen to be doing.

Thankfully the fix is relatively easy, you just need to modify the script slightly.

  1. Do a search in the script for $bcdBootArgs which is usually first referenced at line 4055
  2. On the line a couple below (usually 4057) change the following
    "/s $Drive" modify to "/s $Drive /f ALL"
This tells the BCDboot.exe command to create boot entries to enable the vhd(x) to boot for both BIOS and UEFI systems.
http://technet.microsoft.com/en-us/library/dd744347(v=WS.10).aspx

Save the script and you're good to go!

 

No comments:

Post a Comment