Fully automated VHD install of Windows 8 Developer Preview using PowerShell

 

After reading Scotts excellent post: http://www.hanselman.com/blog/GuideToInstallingAndBootingWindows8DeveloperPreviewOffAVHDVirtualHardDisk.aspx

…and subsequently noticing a smart chap saying something about an easier way in the comments:

image

I decided to go ahead and make this even easier since PowerShell is my new hammer I’m going to take advantage of it. The Creating a Bootable VHD guide does specify that there is a Microsoft PowerShell script which makes this easier, so there is method to my madness.

The relevant code has already been pushed to Github: https://github.com/naeemkhedarun/CreateWindows8VHD

A direct download of the zip is: https://github.com/naeemkhedarun/CreateWindows8VHD/zipball/master

Usage

You need to download and mount the ISO yourself. You can get it from here and I recommend Virtual Clone Drive as a free and lightweight mounting tool.

The script has three parameters:

  1. Full path and name of the VHD you would like to create.
  2. The maximum size of the image.
  3. The drive letter to assign the VDH to (must not be in use).

An example of using it is:

cd C:\projects\CreateWindows8VHD
C:\projects\CreateWindows8VHD> Import-Module .\Create-Windows8VHD.ps1
C:\projects\CreateWindows8VHD> Create-Windows8VHD "C:\vhd\windows8preview.vhd" "30000" "X"

Here’s an example of my output:

image

Following this to set up a dual boot record you can do (where driveletter is what you choose above).

C:\Windows\sysnative\bcdboot.exe driveletter:\Windows

You should now be able to restart into the Windows 8 Preview!

Feel free to submit pull requests and make suggestions.

blog comments powered by Disqus