Wednesday, June 6, 2012

Installing (and booting) Windows 8 on a VHD

Windows 8 (and Server 2012) greatly simplifies installing Windows 7 / Windows Server 2008 R2 / Windows 8 / Windows Server 2012 to a VHD or VHDX for booting without having to mess around with partitions. Convert-WindowsImage.ps1 is a fantastic tool that you can run from Windows 8 or Server 2012 to install a new operating system without rebooting your machine. To install Windows 8 Release Preview on a VHDX, I did the following:

  1. Download and unblock the PowerShell script Convert-WindowsImage.ps1. I couldn't find the unblock checkbox on the file properties dialog, so I used the Sysinternals streams.exe utility to remove the block:
    streams -d Convert-WindowsImage.ps1
  2. I then mounted the Windows 8 ISO image by double clicking on it in Explorer, taking advantage of the belated ISO mounting feature. In my case, it mounted to E:.
  3. Next, I ran Convert-WindowsImage.ps1 with the following command line:
    .\Convert-WindowsImage.ps1 -SourcePath E:\sources\install.wim -VHDFormat VHD -SizeBytes 50GB -VHDPath Windows8RP.vhd -VHDType Fixed -Edition Professional
  4. Mount the VHDX using diskmgmt.msc. I tried using Mount-DiskImage, but kept running into the following error: "Mount-DiskImage : One or more parameter values passed to the method were invalid." My drive was mounted as F:
  5. Run the following command to add your new VHD to the boot menu:
    bcdboot F:\Windows
  6. Reboot and select the new O/S in the boot menu.

0 comments:

Post a Comment