Search This Blog

Tuesday, August 10, 2010

Create a Faster Base image using WIM2VHD and VHDTool

Most of the time we need to create a base image when setup virtual machine. How i normally do this is using Hyper V, install an operating system and run sysprep command? But this process is taking quite a long time especially the duration to setup Windows Server 2008 R2 will take around 30 minute.
Now the question is, how to do it fast within 5 minute?

In this article, i will use Wim2vhd tool. In order to use Wim2VHD, you need to install WAIK for Windows 7. You can get WAIK from this link:- http://www.microsoft.com/downloads/details.aspx?FamilyID=696dd665-9f76-4177-a811-39c26d3b3b34&displaylang=en

Once you have install WAIK, download WIM2VHD from here:- http://code.msdn.microsoft.com/wim2vhd/Release/ProjectReleases.aspx?ReleaseId=2603
It is a small 103K file. Then put this into a folder.

Step 1:-
To execute, go to WAIK- Deployment tool Command prompt.

Step 2:-
Enter the following command to view the parameter. Just like a help syntax
"cscript WIN2VHD.wsf"

Example:- Create a base image Windows Server 2008 R2 Standard Edition




/wim:h:\sources\install.wim
Is refer to the location of the install.wim which located in DVDROM

/sku:serverstandard
Is refer to Windows Server 2008 r2 Standard Edition

Additional /sku parameter:-









Here is the process of the snapshot:-












The tool will create a dynamic disk with default 40GB size. If you want, you can use additional parameter such as
a) /size:51200
To create 50GB partition

b) /disktype:fixed
To create fixed disk vhd. The option available is dynamic, fixed and fast fixed.

Example:- To create a fixed disk of Windows Server 2008 R2 Standard Edition with a size 50GB
C:\WIM>cscript WIM2VHD.wsf /wim:h:\sources\install.wim /sku:serverstandard /disktype:fixed /size:51200

The above command will take almost 15minute. In order to speed up the creation of 50GB fixed disk, i download VHDTool (Download from:-http://code.msdn.microsoft.com/vhdtool). Put this tool inside the WIM2VHD folder and execute below command

C:\WIM>cscript WIM2VHD.wsf /wim:h:\sources\install.wim /sku:serverstandard /disktype:fastfixed /size:51200

Now, you can create 50GB fixed disk in 5 minute. Quite a useful tool and it's FREE!

Check out both tool to explore more cool stuff.