I have been looking for an easy way to create bootable VHD images, to help speed up the deployment of virtual machines.
After some searching, I found the Windows Image to Virtual Hard Disk Converter (aka WIM2VHD) — a free command line tool from Microsoft that “allows you to create sysprepped VHD images from any Windows 7 installation source.”
Not only does it work for Windows 7 installation sources, it apparently also works for Windows Server 2008 R2 installation sources, although I have yet to test that.
Before you start you are going to need a computer (running Windows 7 or Windows Server 2008 R2) with Windows 7 Automated Installation Kit (WAIK) installed along with a Windows 7 or Windows Server 2008 R2 installation source.
If your installation source contains multiple disk images, you must first examine the installation source using the imagex.exe tool (from the WAIK), to find the correct SKU to use for your VHD image.
Use imagex.exe with the /info option to view information about your .wim installation source:
imagex.exe /info e:\sources\install.wim
The <DESCRIPTION> Tag will contain the SKU e.g. Windows 7 ENTERPRISE.
In this example, the install.wim file contains only 1 image — in this case for “Windows 7 Enterprise”:
ImageX Tool for Windows
Copyright (C) Microsoft Corp. All rights reserved.
Version: 6.1.7600.16385
WIM Information:
----------------
Path: e:\sources\install.wim
GUID: {05875eb7-f4a1-42c3-b82f-7e15ec7dff58}
Image Count: 1
Compression: LZX
Part Number: 1/1
Attributes: 0xc
Integrity info
Relative path junction
Available Image Choices:
------------------------
<WIM>
<TOTALBYTES>2089484387</TOTALBYTES>
<IMAGE INDEX="1">
<DIRCOUNT>9358</DIRCOUNT>
<FILECOUNT>47358</FILECOUNT>
<TOTALBYTES>8315649536</TOTALBYTES>
<CREATIONTIME>
<HIGHPART>0x01CA0443</HIGHPART>
<LOWPART>0x6568BDF8</LOWPART>
</CREATIONTIME>
<LASTMODIFICATIONTIME>
<HIGHPART>0x01CA0455</HIGHPART>
<LOWPART>0x4CCB5E5F</LOWPART>
</LASTMODIFICATIONTIME>
<WINDOWS>
<ARCH>0</ARCH>
<PRODUCTNAME>Microsoft® Windows® Operating System</PRODUCTNAME>
<EDITIONID>Enterprise</EDITIONID>
<INSTALLATIONTYPE>Client</INSTALLATIONTYPE>
<HAL>acpiapic</HAL>
<PRODUCTTYPE>WinNT</PRODUCTTYPE>
<PRODUCTSUITE>Terminal Server</PRODUCTSUITE>
<LANGUAGES>
<LANGUAGE>en-US</LANGUAGE>
<DEFAULT>en-US</DEFAULT>
</LANGUAGES>
<VERSION>
<MAJOR>6</MAJOR>
<MINOR>1</MINOR>
<BUILD>7600</BUILD>
<SPBUILD>16385</SPBUILD>
<SPLEVEL>0</SPLEVEL>
</VERSION>
<SYSTEMROOT>WINDOWS</SYSTEMROOT>
</WINDOWS>
<NAME>Windows 7 ENTERPRISE</NAME>
<DESCRIPTION>Windows 7 ENTERPRISE</DESCRIPTION>
<FLAGS>Enterprise</FLAGS>
<HARDLINKBYTES>3348965825</HARDLINKBYTES>
<DISPLAYNAME>Windows 7 Enterprise</DISPLAYNAME>
<DISPLAYDESCRIPTION>Windows 7 Enterprise</DISPLAYDESCRIPTION>
</IMAGE>
</WIM>
You can now use the WIM2VHD script to create the VHD image. Please visit the MSDN website for full details on the exact usage of the WIM2VHD script:
cscript wim2vhd.wsf /wim:e:\sources\install.wim /sku:Windows 7 Enterprise /vhd:c:\vhd\win7ent.vhd
After about 10 minutes, a bootable VHD image will have been created in your specified output folder.
You can now use the VHD image to boot directly into the Out of Box Experience (OOBE), ready for first-use customisations or you can automate the installation by rolling your own unattend.xml file.
No related posts.

Pingback: Native VHD Boot on Windows XP | iconixit blog