Creating a bootable VHD the easy way
So this left me with some alternatives:
- Install the bits on your own x64-machine.
- Use another virtualization platform such as Hyper-V, VMWare or VirtualBox that have support for x64 on my own x64-machine.
- Create a bootable VHD from Windows 7.
I chose the bootable VHD option because I love the feel of Windows 7 and the rich features that Windows 7 gives the end user. On the other side I need the flexibility to start my SharePoint 2010 box when I need that with (almost) no performance loss.
There’s a lot of blogs out there that describe how to create a bootable VHD and so I will not list them here but I will give you a nice automated head start (without MB’s of download).
In the linked CreateBootableVHD_v2.zip you will find two files:
- CreateBootableVHD_v2.bat, the batch-file with all the magic

- Install-WindowsImage.ps1, a power shell script from http://code.msdn.microsoft.com/InstallWindowsImage.
Requirements:
- A machine running Windows 7 or Windows Server 2008 R2.
- Windows 7 or Windows Server 2008 R2 installation media or a Windows 7 or Windows Server 2008 R2 .wim image captured from a reference machine.
The following steps are provided with a “works on my box” guarantee.
- Download the linked zip-package.
- Select Properties on the zip-package and click on the Unblock button.
- Extract the zip-package to a folder of your choice.
- For each extracted file select Properties and click on the Unblock button.
- Mount your installation media from an iso file or DVD.
- Look for the file “install.wim” on your installation media (see number 3 above) and remember the path, in my case F:\sources\install.wim.
- Open a PowerShell command prompt with the run as Administrator option. You need to run the attached bat-file from a PowerShell console as an Administrator and not from the usual command prompt. (thanks Johan for pointing out this clarification!)
- Change directory to the directory where you extracted the zip-package.
- Before I show you how to use the CreateBootableVHD.bat file there is 2 important concepts that you need to know:
- The third parameter in CreateBootableVHD.bat expects you to enter the type of VHD that you want to create. If you choose DYNAMIC EXPANDABLE (thanks Markus for pointing out this error!) you will need to make sure that you have the specified amount of GB left for the VHD even though the VHD will be small at first.
- CreateBootableVHD.bat will assign your bootable VHD a drive letter, it’s very important to use a FREE drive letter.
- When you enter a drive letter make sure you don’t enter a colon after the letter i.e. X and never X:. (thanks Markus for pointing out this clarification!)
- Now you’re ready to use the CreateBootableVHD.bat-file like this:
CreateBootableVHD_v2.bat <path where you like to store the VHD, doesn’t work on external drives> <size in MB> <type FIXED|DYNAMICEXPANDABLE> <drive letter assigned to the VHD> <path to the wim-file, see number 4 above>.
Ex: .\CreateBootableVHD_v2.bat C:\VHD\W2k8.vhd 40000 FIXED X F:\sources\install.wim
To show an actual example here is a snapshot from my latest run:
After 30-60 minutes depending on the size of the VHD and your hardware you’ll have a new boot option.
Hope you enjoy the script.
Hugo






Oct 01, 2010 @ 10:38:34
Haha, “works on my box” guarantee…
←
Hugo Häggmark » Creating a bootable VHD the easy way…continued
Nov 15, 2010 @ 21:35:19
[...] might have read and tried the scripts from my first blog about creating a bootable vhd here, and in this blog post I’ll continue where I left with some information about my usage of [...]
←
My 15 favorite blog posts of 2010 - Mikael Håkansson
Dec 22, 2010 @ 21:00:51
[...] http://www.hugohaggmark.com/2010/09/23/creating-a-bootable-vhd-the-easy-way/ http://www.hugohaggmark.com/2010/11/15/creating-a-bootable-vhd-the-easy-waycontinued/ [...]
←
Apr 01, 2011 @ 21:48:09
The sample should be:
CreateBootableVHD_v2.bat C:\VHD\W2k8.vhd 40000 FIXED X F:\sources\install.wim
(as you’ve updated the name of the bat file)
Thanks again for writing this post Hugo.
←
Apr 02, 2011 @ 07:35:07
Thanks Mikael for the feedback!
I’ve changed the post now…cheers!
←
Hugo Häggmark » Creating a bootable VHD the easy way…about Indexes
Apr 05, 2011 @ 08:14:49
[...] seen a lot of people using and downloading my bat-file from my original post here and some of you have even tried some of my more advanced topics [...]
←
Hugo Häggmark » The easiest way to Install and Booting Windows 8 Developer Preview off a VHD (Virtual Hard Disk)
Sep 17, 2011 @ 16:31:29
[...] Developer Preview booting off a VHD. If you’re interested in more details read my previous posts here, here and [...]
←
Dec 28, 2011 @ 22:03:10
Works like a charm! You are a bad ass! thank you so much for posting this.
←
Dec 29, 2011 @ 16:54:33
You’re welcome!
←
Feb 18, 2012 @ 22:50:19
Yes! This is very cool! I’ve been using VMWare Web Infrastructure for SharePoint 2010 work but it runs sooo slow and I have been meaning to make a direct VHD boot disk for Win Svr 2008 on my Win 7 laptop for ages.
I never got round to it. Now though with the info above I am sitting looking at Powershell saying it is 26% complete! Sweet…
Not much hassle for a lot of payback good stuff!
Creating a bootable VHD the easy way…
Oh and the command should be:
.\CreateBootableVHD_v2.bat C:\VHD\W2k8.vhd 100000 FIXED X F:\sources\install.wim
At least I needed to use:
.\
before the main command in Powershell….
←
Feb 20, 2012 @ 07:23:22
Thank you for the feedback! I’ll change the posts…
←