Fully automated VHD install of Windows 8 Developer Preview using PowerShell

by Naeem Khedarun 15. September 2011 08:47

 

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.

Categories: PowerShell

Comments

Mike Brown
Mike Brown United States on 9/15/2011 10:44:04 AM

I type the command and it does nothing.

Jason Archer
Jason Archer United States on 9/15/2011 12:55:29 PM

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

Jonathan
Jonathan United States on 9/15/2011 2:49:55 PM

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.

avesse
avesse South Africa on 9/16/2011 5:05:13 AM

Thanks, this helped!

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

trackback
#Fellows on 9/16/2011 5:32:09 AM

How to set up a Windows 8 virtual machine

How to set up a Windows 8 virtual machine

Dan Vanderboom
Dan Vanderboom United States on 9/17/2011 7:23:03 AM

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

Ashaq Ali
Ashaq Ali India on 9/18/2011 12:15:20 AM


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

great post Thanks a lot

pingback
rohiton.net on 9/18/2011 5:23:57 PM

Pingback from rohiton.net

Automate installation of windows 8 via powershell script « My musings on .Net Technology

James Dawson
James Dawson United Kingdom on 9/19/2011 11:33:37 PM

Nicely done Naeem - worked fine for me first time.

pingback
mrubino.net on 9/20/2011 6:16:49 AM

Pingback from mrubino.net

Instalar Windows 8 sin USB/DVD de inicio

trackback
Marc Rubiño on 9/20/2011 6:45:26 AM

Instalar Windows 8 sin USB/DVD de inicio

Esta semana ha habido un gran revuelo con el BUILD y todo el mundo se ha vuelto loco intentando ser el

pingback
siteduct.com on 12/22/2012 1:50:55 AM

Pingback from siteduct.com

PHP Script Installation Service

pingback
sitefixing.com on 2/11/2013 6:54:04 PM

Pingback from sitefixing.com

Fix My Website

Comments are closed