Converting Windows 7 deployment images to virtual hard drive files

Microsoft has made it easier to deploy custom desktop images with a feature in Windows Server 2009 R2 that allows you to convert a.WIM file to a virtual hard drive file.

Administrators frequently have to deploy Windows to new machines and reinstall it on to computers that are having

problems. Since manual deployments can be time consuming, many organizations rely on Windows Deployment Services. With this technology, a Windows Image (.WIM) file and an optional unattended answer file are created and then custom images are deployed to workstations from across the network.

Windows Deployment Services still exists in Windows Server 2008 R2 has and features added image-deployment capabilities. The most notable of these new capabilities involves using virtual hard drive (VHD) files in place of .WIM files.

Windows 7 and Windows Server 2008 R2 offer the new feature native boot. As strange as it may sound, native boot allows a physical computer to boot from a virtual hard drive file without the aid of a parent operating system or a hypervisor. With native boot, Windows is not subject to the limitations that normally exist for virtual machines. In fact, Windows will have full access to all of the computer's physical disks and to other hardware.

Creating a virtual hard drive file

The easiest way to build a virtual hard drive file is to use Microsoft's Windows Image to Virtual Hard Disk Converter utility, which is better known as WIM2VHD. This utility can be downloaded from Microsoft's website. At the time this article was written, the WIM2VHD utility was still in the Release Candidate phase of testing, but the final release is expected soon.

The WIM2VHD utility is designed to create a sysprepped virtual hard drive from a Windows 7 or Windows Server 2008 R2 deployment image file. The utility itself is a .WSF file rather than a standard executable, so when running it, the CSCRIPT command needs to be used.

The command's full syntax is as follows:
Usage: WIM2VHD.WSF /wim: /sku: [/vhd: ] [/size: ] [/disktype: ] [/unattend: ] [/qfe: ] [/ref: ] [/copylocal: ][/passthru: ] [/signdisk: ] [/mergefolder: ]

The WIM2VHD utility is a command-line tool, and there are quite a few switches that could be used with it. This utility is easier to use than it first appears because only two of the parameters are actually required -- everything else is optional.

The first required parameter is the /WIM switch. This parameter must be used to specify the path to the .WIM file from which you want to create the virtual hard drive.

The second required parameter is the /SKU switch. The SKU tells the WIM2VHD utility which edition of Windows to deploy. For example, ServerStandard and ServerDatacenterCore are both valid SKUs.

Now suppose you wanted to create a virtual hard drive file based on an image named INSTALL.WIM, and you wanted the virtual hard drive to run Windows 7 Ultimate.

The virtual hard drive file could by created with the following command:
Cscript wim2vhd.wsf /wim:C:\temp\install.wim /sku:ultimate

This is a simplified example. In the real world, you would probably want to specify the name of the .VHD file that you are creating. You can do so by appending the /VHD switch. Here is an example:
Cscript wim2vhd.wsf /wim:C:\temp\install.wim /sku:ultimate /VHD:c:\temp\install.vhd

Another common parameter is the /Unattended switch. This switch allows you to automate the installation process by providing Windows with an answer file it can use during setup.

If you wanted to use an answer file, the command would look something like this:
Cscript wim2vhd.wsf /wim:C:\temp\install.wim /sku:ultimate /unattend:C:\temp\unattend.xml

Converting a .WIM file into a VHD file is a fairly simple process. Even though this technique will allow a VHD file to be created from a Windows deployment image, the virtual hard drive still has to be deployed before the native boot can be used. The deployment process requires Windows Deployment Services and is similar to how a standard deployment image would be deployed, but you need to be aware of some VHD- specific steps. Microsoft offers a TechNet article that guides you through the entire deployment process.

ABOUT THE AUTHOR:   
Brien M. Posey, MCSE
Brien M. Posey, MCSE, is a Microsoft Most Valuable Professional for his work with Exchange Server and has previously received Microsoft's MVP award for Windows Server and Internet Information Server (IIS). He has served as CIO for a nationwide chain of hospitals and was once responsible for the Department of Information Management at Fort Knox. As a freelance technical writer, Posey has written for Microsoft, TechTarget, CNET, ZDNet, MSD2D, Relevant Technologies and other technology companies. You can visit his personal website at www.brienposey.com.

This was first published in October 2009

Dig deeper on Microsoft Windows 7 operating system

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchVirtualDesktop

SearchWindowsServer

SearchExchange

Close