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.

September 15 2011

Comments (7) -

Mike Brown

I type the command and it does nothing.

Mike Brown | 9/15/2011 7:44:04 PM |

Jason Archer

After getting past a few failures with the script, I ran into Error=5 when trying to apply the image.  Frown

Jason Archer | 9/15/2011 9:55:29 PM |

Jonathan

I ran the script and am now on the Applying Windows Developer Preview part.  I will leave my computer running overnight but I feel like it is not being installed as my mounted VHD is still blank.

Jonathan | 9/15/2011 11:49:55 PM |

avesse

Thanks, this helped!

For those who don't know (I didn't), you also need to have something called WAIK installed (www.microsoft.com/download/en/details.aspx?id=5753).  Before I installed it I also got the Error=5 message, after installing everything ran fine.

avesse | 9/16/2011 2:05:13 PM |

Dan Vanderboom

If you've never worked with PowerShell before, you'll want to read this: technet.microsoft.com/en-us/library/ee176949.aspx

Dan Vanderboom | 9/17/2011 4:23:03 PM |

Ashaq Ali


it will better to add another argument for ISO mounted image path.

great post Thanks a lot

Ashaq Ali | 9/18/2011 9:15:20 AM |

James Dawson

Nicely done Naeem - worked fine for me first time.

James Dawson | 9/20/2011 8:33:37 AM |

Pingbacks and trackbacks (6)+

Comments are closed