Feb 252009

If you want to convert Convert a WIM image to a VHD image you can use WIM2VHD is a new free command line tool .

The Windows(R) Image to Virtual Hard Disk (WIM2VHD) command-line tool allows you to create sysprepped VHD images from any Windows 7 installation source. VHDs created by WIM2VHD will boot directly to the Out Of Box Experience, ready for your first-use customizations. You can also automate the OOBE by supplying your own unattend.xml file, making the possibilities limitless.

Fresh squeezed, organically grown, free-range VHDs – just like Mom used to make – that work with Virtual PC, Virtual Server, Microsoft Hyper-V, and Windows 7's new Native VHD-Boot functionality!


A computer running one of the following Windows operating systems:
Windows 7
Windows Server 2008 R2
Windows Server 2008 with Hyper-V RTM enabled (x64 only)
The Windows 7 Beta Automated Installation Kit (AIK) or Windows OEM Pre-Installation Kit (OPK) installed.
A Windows 7 or Windows Server 2008 R2 installation source, or another Windows image captured to a .WIM file.


WIM2VHD.WSF /wim:wimPath /sku:sku
[/vhd:vhdPath] [/size:vhdSizeInMb] [/disktype:dynamic|fixed]
[/unattend:unattendXmlPath] [/qfe:qfe1,...,qfeN]
[/hyperv:true|false] [/ref:ref1,...,refN] [/dbg:args]

Required parameters:


The path of the WIM file to use when creating the VHD.  For example:

Where X: is the drive letter of your DVD ROM drive.


The SKU within the WIM to use when creating the VHD (e.g. “ServerStandard”,
“ServerDatacenterCore”, “2″, etc.).  This value can either be passed as a
SKU name (typically the easiest method) or as a SKU index (which requires
you to have manually inspected the WIM with a tool like IMAGEX.EXE).

Optional parameters:


The path and name of the VHD to be created.  If a file with this name
already exists, it will be overwritten.  If no VHD is specified, a VHD will
be created in the current folder with a name in the following format:


For Fixed disks, this is the size in MB of the VHD that will be created.
For Dynamic disks, this is the maximum size in MB that the VHD can grow to
as additional space is required.
If unspecified, a default value of 40960 MB (40 GB) will be used.


Specifies what kind of VHD should be created: Dynamic or Fixed.
A Fixed disk allocates all of the necessary disk space for the VHD upon
creation.  A Dynamic disk only allocates the space required by files in
the VHD at any given time, and will grow as more space is required.
The default value is Dynamic.


The path to an unattend.xml file that will be used to automate the OOBE
portion of Windows setup the first time the VHD is booted.


A comma-separated list of QFEs to apply to the VHD after the WIM is
applied. These must be CBB/CBS servicing CAB files that were extracted from
.MSU files.

To extract a CAB from an .MSU, use the following command:

expand -f:win*.cab  .MSU file  location to extract to


A comma-separated list of WIM pieces to apply to the VHD.
A “WIM piece” is the result of a Split WIM, and typically has a .SWM
file extension.  The first piece of the Split WIM should be specified with the
/WIM switch.  Subsequent pieces should be specified (in order) with /REF.
ex: WIM2VHD.WSF /WIM:C:\split.swm /REF:C:\split2.swm,c:\split3.swm

See IMAGEX.EXE /SPLIT /? for more information.


Configures debugging in the OS on the VHD.
/dbg:serial,1,115200 – configures serial debugging on COM1 at 115200bps
/dbg:1394,10 – configures 1394 debugging on channel 10
/dbg:usb,debugging – configures USB debugging with the target DEBUGGING


Forces WIM2VHD.WSF to use Hyper-V VHD handling instead of native
Windows 7/Server 2008 R2 VHD handling.  Default value is “false”.


Applies the WIM directly to the specified drive and makes it bootable.
NOTE: The partition on the disk must be marked as ACTIVE in order to boot
successfully. This action is NOT performed by WIM2VHD.WSF.

WIM2VHD Examples

Create a Windows Server 2008 R2 Server Standard Core VHD, named foo.vhd

Create a Windows Server 2008 R2 Server Standard VHD with an automatically generated name

Create a Windows 7 Home Premium VHD with an automated setup answer file
CSCRIPT WIM2VHD.WSF /WIM:X:\sources\install.wim /SKU:HOMEPREMIUM /UNATTEND:C:\stuff\unattend.xml

Apply the first image in a custom WIM to a VHD named custom.vhd

CSCRIPT WIM2VHD.WSF /WIM:C:\stuff\custom.wim /SKU:1 /VHD:C:\custom.vhd


Incoming search terms:

Sorry, the comment form is closed at this time.