Documente Academic
Documente Profesional
Documente Cultură
0 Contents
Windows Image to Virtual Hard Disk (WIM2VHD) Converter Build 6.1.7600.0 ......................................... 1 Introduction .............................................................................................................................................. 2 License....................................................................................................................................................... 2 Requirements............................................................................................................................................ 2 Usage......................................................................................................................................................... 3 Determining which SKUs are available in a .WIM file ............................................................................... 5 Use IMAGEX.EXE to get Image information .......................................................................................... 5 Use WIM2VHD to get Image Information: ............................................................................................ 6 Example Creating a Windows Server 2008 R2 Standard Core VHD ..................................................... 7 Example Creating a Windows 7 Ultimate VHD with a hotfix applied .................................................. 7 Troubleshooting ........................................................................................................................................ 7 Privacy ....................................................................................................................................................... 8 Considerations and Tips ............................................................................................................................ 8
Windows Image to Virtual Hard Disk (WIM2VHD) Converter Build 6.1.7600.0 Mike Kolitz, Hyper-V Team, Microsoft Corporation
Page 1
Introduction
The Windows Image to Virtual Hard Disk Converter (or WIM2VHD) was developed in part by Mike Kolitz, a Software Design Engineer in Test in the Hyper-V team at Microsoft Corporation. To contact me, please visit my blog (http://blogs.msdn.com/mikekol) and use the e-mail option, or use the Discussion feature on the WIM2VHD website listed below. If you find a bug or want to suggest an improvement, please file an Issue at http://code.msdn.microsoft.com/wim2vhd. WIM2VHD will allow you to make a bootable VHD directly from Windows 7 or Windows Server 2008 R2 installation media without having to go through Windows Setup. The VHD can then be used in Virtual PC, Virtual Server, Hyper-V, or booted natively on a system with the Windows 7/Server 2008 R2 boot loader. The VHDs will be in a generalized (syspreped) state, and will specialize themselves for the computer theyre booted on during the first boot. This means that a single VHD generated with this tool can be deployed to multiple computers, just like any other syspreped Windows image. Version 0.1 0.2 0.3 1.0 Date January 28, 2009 February 12, 2009 April 30, 2009 October 21, 2009 Change History First draft Added a Privacy section Updated for WIM2VHD RC. Updated for WIM2VHD RTW.
License
WIM2VHD and associated documentation are licensed under the Microsoft Public License (Ms-PL) as described at http://code.msdn.microsoft.com/WIM2VHD/Project/License.aspx WIM2VHD and the associated documentation are provided AS-IS. You bear the risk of using it. No express warranties, guarantees or conditions are provided. WIM2VHD is not supported or endorsed by Microsoft Corporation and should be used at your own risk.
Requirements
A machine running Windows 7 RTM or higher, Windows Server 2008 R2 RTM or higher, or Windows Server 2008 SP2 with Hyper-V RTM enabled. Download and install the Windows 7/Server 2008 R2 Automated Installation Kit (AIK) or the Windows 7/Server 2008 R2 OEM Preinstallation Kit (OPK). Windows 7 or Windows Server 2008 installation media.
Windows Image to Virtual Hard Disk (WIM2VHD) Converter Build 6.1.7600.0 Mike Kolitz, Hyper-V Team, Microsoft Corporation
Page 2
Usage
Usage: WIM2VHD.WSF /wim:<wimPath> /sku:<sku> [/vhd:<vhdPath>] [/size:<vhdSizeInMb>] [/disktype:<dynamic|fixed|fastfixed>] [/unattend:<unattendXmlPath>] [/qfe:<qfe1,...,qfeN>] [/ref:<ref1,...,refN] [/dbg:<args>] [/copylocal:<localFolder>] [/passthru:<physicalDrive>] [/signdisk:<true|false>] [/mergefolder:<folderToMerge>] Required parameters: /wim:<wimPath> The path of the WIM file to use when creating the VHD. X:\sources\install.wim Where X: is the drive letter of your DVD ROM drive.
For example:
/sku:<skuName>|<skuIndex> 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: /vhd:<vhdPath> 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: <Major>.<Minor>.<Build>.<Rev>.<Arch>.<Branch>.<Timestamp>.<SKU>.<Lang>.vhd ex: 6.1.7600.16385.x86fre.win7_rtm.090713-1255.Ultimate.en-us.vhd NOTE: If the language cannot be determined from the WIM, no <Lang> block will be included in the VHD name. /size:<vhdSizeInMb> 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. /disktype:<Dynamic|Fixed|FastFixed> Specifies what kind of VHD should be created: Dynamic, Fixed or FastFixed. 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. FastFixed provides the option to create a Fixed VHD much faster than the Fixed option. This functionality requires VHDTOOL.EXE, which is available from http://code.microsoft.msdn.com/vhdtool. This tool is Windows Image to Virtual Hard Disk (WIM2VHD) Converter Build 6.1.7600.0 Mike Kolitz, Hyper-V Team, Microsoft Corporation
Page 3
unsupported by Microsoft, and can potentially cause security concerns. The default value is Dynamic. /unattend:<unattendXmlPath> 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. /qfe:<qfe1,...,qfeN> A comma-separated list of QFEs to apply to the VHD after the WIM is applied. QFEs must be in the .MSU file format, which is the default QFE format for Windows 7. They can also be provided in a .CAB format if you'd prefer to extract the .CABs from the .MSU files. To extract a CAB from an .MSU, use the following command: expand -f:win*.cab <.MSU file> <location to extract to> /ref:<ref1,...,refN> 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 with /REF. ex: WIM2VHD.WSF /WIM:C:\split.swm /REF:C:\split2.swm,c:\split3.swm See IMAGEX.EXE /SPLIT /? for more information. /dbg:<protocol>,<port/channel/target>[,<baudrate>] Configures debugging in the OS on the VHD. examples: /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 /copylocal:<localFolder> Copies all of the files necessary to run WIM2VHD.WSF to localFolder, eliminating the need to install the Windows AIK or OPK. This does not include any WIM files, just the binaries that WIM2VHD.WSF depends on. After this operating completes, run WIM2VHD.WSF from localFolder. If this switch is specified, no VHD will be created. /passthru:<physicalDrive> 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. /signdisk:<true|false> Specifies whether or not WIM2VHD.WSF should leave a signature on the VHD that indicates what version of WIM2VHD.WSF created the VHD, and the date Windows Image to Virtual Hard Disk (WIM2VHD) Converter Build 6.1.7600.0 Mike Kolitz, Hyper-V Team, Microsoft Corporation
Page 4
of creation. The signature will be located at <VHD>:\Windows\WIM2VHD.TXT. The default value is "true". /mergefolder:<folderToMerge> Copies the contents of folderToMerge to the root directory of the VHD. This includes all subfiles and subfolders. Any files that already exist on the VHD will be overwritten.
Page 5
<WINDOWS> <ARCH>9</ARCH> <PRODUCTNAME>Microsoft Windows Operating System</PRODUCTNAME> <EDITIONID>ServerStandard</EDITIONID> <INSTALLATIONTYPE>Server Core</INSTALLATIONTYPE> </WINDOWS> <NAME>Windows 7 SERVERSTANDARDCORE</NAME> <DESCRIPTION>Windows 7 SERVERSTANDARDCORE</DESCRIPTION> </IMAGE> </WIM>
The above example shows that there are two images in the specified .WIM file. The DESCRIPTION element can be used to determine which SKUs are available for installation. Remove the Windows 7 prefix to determine the SKU name, e.g. for the description Windows 7 SERVERSTANDARD, the SKU is called SERVERSTANDARD and would be passed to WIM2VHD as /SKU:SERVERSTANDARD. Alternately, you can specify the Image Index instead of the SKU name to WIM2VHDs /SKU switch (/SKU:1 is the same as /SKU:SERVERSTANDARD in the example above). Note If youre using custom .WIM files that were not created by Microsoft, it is recommended that you use the Image Index to indicate which image to apply. Use WIM2VHD to get Image Information: WIM2VHD can also provide you with a list of SKUs that are available in a given .WIM file. That information is provided in the error text when the SKU specified with the /SKU switch cannot be found in the specified .WIM file. To get the list of SKUs, simply omit the /SKU argument from your command line.
cscript wim2vhd.wsf /wim:x:\sources\install.wim
From that list, you can see that your choices are SERVERSTANDARD and SERVERSTANDARDCORE, which can then be specified with the /SKU switch.
Windows Image to Virtual Hard Disk (WIM2VHD) Converter Build 6.1.7600.0 Mike Kolitz, Hyper-V Team, Microsoft Corporation
Page 6
Note This is not likely to work well in combination with .WIM files that are not part of Windows installation media. Note If your .WIM file only contains a single image, WIM2VHD will automatically select that image and begin applying it to a VHD. If you are unsure as to how many images your .WIM file contains, you should use IMAGEX.EXE to list the possible images. Note .WIM files that contain versions of Windows earlier than Windows 7 are not tested with WIM2VHD, and will very likely cause WIM2VHD to fail.
3. Once the process is complete, you can attach the VHD to a virtual machine and boot, or you can boot natively if your system has a Windows 7/Server 2008 R2 boot manager.
4. Once the process is complete, you can attach the VHD to a virtual machine and boot, or you can boot natively if your system has a Windows 7/Server 2008 R2 boot manager.
Troubleshooting
If you encounter problems while running WIM2VHD, there are two features that can help you diagnose the problem. WIM2VHD generates a log file containing all of the output that is sent to the console. You can reference this log file to search for errors.
Windows Image to Virtual Hard Disk (WIM2VHD) Converter Build 6.1.7600.0 Mike Kolitz, Hyper-V Team, Microsoft Corporation
Page 7
If that output is not helpful, you can enable a more verbose output mode which will write more information to the console and the log file. To enable this feature, add /trace:true to your WIM2VHD command line.
Privacy
WIM2VHD does not transmit any information about you, your computers, or the VHDs you create to anyone. Assuming that youre not writing data to or reading data from a remote share, WIM2VHD does not transmit any information of any kind. During VHD creation, WIM2VHD will create a file on the VHD which contains the version number of WIM2VHD that is currently running, as well as the time and date that the VHD was created. This file is located at C:\WINDOWS\WIM2VHD.TXT inside the VHD, and is safe to delete. It is only present for informational purposes. You can disable the creation of this file by specifying /SIGNDISK:FALSE on your WIM2VHD command line.
Windows Image to Virtual Hard Disk (WIM2VHD) Converter Build 6.1.7600.0 Mike Kolitz, Hyper-V Team, Microsoft Corporation
Page 8
WIM2VHD uses NTFS mount points when mounting the new VHD so that you can run multiple instances of WIM2VHD simultaneously. You can force the use of drive letter by specifying /classicmount:true on the command line. Only Windows 7 and Windows Server 2008 R2 images are supported. Offline Windows installation is a supported method of installation for Windows 7 and Windows Server 2008 R2. The process (which is implemented by WIM2VHD) is documented in the Windows 7/Server 2008 R2 OPK and AIK.
Windows Image to Virtual Hard Disk (WIM2VHD) Converter Build 6.1.7600.0 Mike Kolitz, Hyper-V Team, Microsoft Corporation
Page 9