Partager via


Faster Creation of Virtual Machines

I recently noticed a blog post on TechNet about a new tool that was released on CodePlex.  WIM2VHD is a command-line tool allows you to create sysprepped VHD images from any Windows 7 installation source (and I suspect Windows Server 2008 R2 as well) that work with Virtual PC, Virtual Server, Microsoft Hyper-V, and Windows 7's new Native VHD-Boot functionality.  Basically, you can create an entire virtual machine VHD file in minutes without have to go through the whole setup process of Windows.  It is nice and simple to use, and after a brief moment of confusion I had it working fine :-)

 

To create my first VHD file, I ran the command: cscript.exe C:\Users\Administrator\Desktop\WIM2VHD.wsf /wim:e:\sources\install.wim /sku:Ultimate /vhd:U:\Hyper-V\Win7.vhd /size:12000 /disktype:Dynamic

However, this failed (as shown below) with the error “Error: 0: No filePath was specified”.  After fiddling around with the command line to make sure that I was specifying the relevant paths, I realised that WIM2VHD was failing because it was unable to mount the WIM file from the Windows 7 DVD.

image

 

In order to mount WIM files, you first need to have installed the Windows Automated Installation Kit (WAIK), which you can get here: www.microsoft.com/downloads/details.aspx?familyid=4AD85860-D1F4-42A1-A46C-E039E3D0DB5D&displaylang=en.  One thing to note is that I installed the beta version that was released for Windows 7.  I do not actually know if the current 1.1 version will work with WIM2VHD, I imagine so.  The 1.1 version can be found here: www.microsoft.com/downloads/details.aspx?familyid=94BB6E34-D890-4932-81A5-5B50C657DE08&displaylang=en

 

Once that was installed, I simply re-ran the previous command and, as you can see, had much more success!

image

image

This really is a great tool, as you can create virtual machines extremely quickly.  And, the possibilities are endless because you could incorporate WIM2VHD into existing processes so that you could provision new computers easily and quickly on-the-fly using scripts.