Deploying Virtual Hard Disk Images

Applies To: Windows Server 2008 R2

In Windows Server 2008 R2, you can deploy virtual hard disk (.vhd) images of Windows Server 2008 R2 to a physical (not virtual) computer using Windows Deployment Services. In general, you deploy .vhd images in the same way that you deploy .wim images. However, using WDSUTIL at the command line is the only supported method of adding and configuring the images. In addition, the deployment must be part of an automated installation. For more information about .vhd images, see https://go.microsoft.com/fwlink/?LinkId=139201.

To deploy .vhd images, follow the steps in this section. First, you will need to create an image group and add images to it. Then you create an unattend file and configure the server. After that, you will be ready to deploy and image. Note that configuring multicasting is optional.

In this topic

  • Prerequisites for deploying virtual hard disk images

  • Known issues with deploying virtual hard disk images

  • Adding a virtual hard disk image to the server

  • Configuring an unattended installation for a virtual hard disk image

  • Creating a multicast transmission for a virtual hard disk image

  • Deploying an image

  • Other supported commands

  • Parameters

  • Sample client unattend file for .vhd deployment

Prerequisites for deploying virtual hard disk images

To deploy .vhd images, you need the following:

  • A configured Windows Deployment Services server with at least one boot image. In most scenarios, you should use the Boot.wim file from the Windows Server 2008 R2 or Windows 7 installation DVD (in the \Sources folder). For information about installing and configuring your server, see the Windows Deployment Services Getting Started Guide (https://go.microsoft.com/fwlink/?LinkId=84628).

  • Familiarity with WDSUTIL. The only way to import and configure these images is through the WDSUTIL command-line tool. For information about the commands in this topic, run WDSUTIL /?. You can also download the WDSUTIL command-line reference at https://go.microsoft.com/fwlink/?LinkId=89381.

  • A supported .vhd image. The only supported operating systems are Windows Server 2008 R2, Windows 7 Enterprise, and Windows 7 Ultimate. Fixed, dynamic, and differencing .vhd images are supported. However, note that a supported image cannot contain the following:

    • More than one operating system.

    • More than one partition.

    • Applications or data (instead of an operating system).

    • A 64-bit operating system that is partitioned with a GUID partition table (GPT).

Known issues with deploying virtual hard disk images

  • Virtual hard disk images may show up in the Windows Deployment Services MMC snap in, or in the user interface on the client, but deploying .vhd images is only supported for unattend installations.

  • The only supported actions are those documented in this section.

Adding a virtual hard disk image to the server

The first step in deploying .vhd images is to add them to an image group on the server.

Note

Although using the MMC snap-in to configure .vhd images is not supported, after you add an image using WDSUTIL, you must refresh the server node in the MMC snap-in in order for the new image to appear.

To add a virtual hard disk image to the server

  1. Click Start, right-click Command Prompt, and then click Run as administrator.

  2. You must create an image group because .vhd images cannot be in image groups with .wim images. To create an image group for the .vhd image, use the following syntax: WDSUTIL /Add-ImageGroup /ImageGroup:<image group name>.

    Example: WDSUTIL /Add-ImageGroup /ImageGroup:”VHD Image Group”

  3. To add the .vhd image to the server, use the following syntax (at a minimum): WDSUTIL /Verbose /Progress /Add-Image /ImageFile:<path> /ImageType:Install /ImageGroup:<image group name>.

    For differencing disks, the path to the image should be to the .vhd file of the differencing disk and not to the parent disk. Adding the differencing .vhd will add the parent .vhd file to the server, but only the differencing disk will be active (the parent .vhd will be inactive). If the differencing disk is part of chain, choose the last .vhd in the chain. In that case, the immediate parent .vhd and all preceding parent .vhd files in the chain will also be added.

    Full syntax: WDSUTIL /add-Image /ImageFile:<.vhd file path> [/Server:<server name>] /ImageType:install [/ImageGroup:<image group name>] [/Filename:<new image file name>] [/UnattendFile:<full path to unattend file>]

    Example: WDSUTIL /Verbose /Progress /Add-Image /ImageFile:”C:\vhd\WindowsServer2008R2.vhd” /Server:MyWDSServer /ImageType:Install /ImageGroup:”VHD Image Group”

  4. Repeat step 3 until you have added all of your .vhd images.

  5. If you want to update the description for an image, use the following steps:

    1. Run WDSUTIL /Get-ImageGroup /ImageGroup:<image group name> and note the name that the server assigned to the image. To display the full image metadata on each image in the group, append /Detailed.

      Example: WDSUTIL /Get-ImageGroup /ImageGroup:”VHD Image Group”

    2. To update the description for an image, use the following syntax where <image name> is the name you noted in the previous step: WDSUTIL /Set-Image /Image:<image name> /ImageType:Install /ImageGroup:<image group name> /Description:<description>.

      Example: WDSUTIL /Set-Image /Image:”VHD image” /ImageType:Install /ImageGroup:”VHD Image Group” /Description:”VHD image for R2”

Note

To update other metadata for the image (such as the image name), see “Other Supported Commands”, later in this topic.

Configuring an unattended installation for a virtual hard disk image

Now that you have .vhd images on your server, you must configure an unattended installation for the images. To do this, you will need to create two unattend .xml files. One of the unattend files automates the Windows Deployment Services client user interface (UI) screens, and the other one automates the remaining phases of Setup. You should author both files by using Windows SIM.

Windows Deployment Services Client Unattend File

First, create an Unattend.xml file for the .vhd image with settings applicable to Windows Deployment Services client UI screens (for entering credentials, choosing an install image, configuring the disk, and so on). For details about each section of this file, see the “Automating the User Interface Screens of the Windows Deployment Services client” section of Automating Setup (https://go.microsoft.com/fwlink/?LinkId=89226).

For an example file, see the Sample client unattend file for .vhd deployment, but note that you should modify the <InstallImage> section to match the .vhd image and the <Credentials> section. In addition, processorArchitecture must match the version of Windows Preinstallation Environment (Windows PE) of your boot image.

After you have created the file, you must associate it with a client. There are three ways you can do this:

  • Prestage a specific client with a client unattend file. You can use Windows Deployment Services to link physical computers to computer account objects in Active Directory Domain Services (AD DS). This is called prestaging the client. Prestaged clients are also called “known computers”. Prestaging a client allows you to configure properties on the computer account to control the installation for the client. For more information, see https://go.microsoft.com/fwlink/?LinkID=131987. Use the following procedure to prestage a client with an unattend file.

    To prestage a client computer with a client unattend file

    1. Click Start, right-click Command Prompt, and then click Run as administrator.

    2. To prestage the computer, use the following syntax: WDSUTIL /Add-Device /Device:<name> /ID:<GUID or MAC>.

      Example: WDSUTIL /Add-Device /Device:Computer1 /ID:ACEFA3E81F20694E953EB2DAA1E8B1B6

    3. To associate an unattend file with the prestaged client, use the following syntax where <path> is the relative path to the unattend file from the Remote Install folder: WDSUTIL /Set-Device /Device:<name> /WDSClientUnattend:<path>.

      Example: WDSUTIL /Set-Device /Device:Computer1 /WDSClientUnattend:WDSClientUnattend\Unattend.xml

  • Enable the Auto-Add policy and assign the client unattend file when you approve the installation. You can enable the Auto-Add policy to specify that unknown computers (computers that have not been prestaged in AD DS) require administrative approval before they will be allowed to boot against the server to install an operating system. Clients that are awaiting approval will be shown in the Pending Devices node of the MMC snap-in. If you approve the pending computer, the computer will continue booting from the network, and a computer account object will be created in AD DS to represent the physical computer. This is helpful because it gives you the ability to prestage computers without needing to know the client computer's GUID or MAC address in advance.

    To enable the Auto-Add policy and associate a client unattend file

    1. Right-click the server and click Properties.

    2. On the PXE Response tab, select For unknown clients, notify administrator and respond after approval.

    3. When an unknown computer boots to the server, the computer will appear in the Pending Devices node of the MMC snap-in. To approve the computer and associate an unattend file with it, use the following syntax where <path> is the relative path to the unattend file from the RemoteInstall folder: WDSUTIL /Approve-AutoAddDevices /RequestID:<ID> /WDSClientUnattend:<path>.

      Example: WDSUTIL /Approve-AutoAddDevices /RequestID:<ID> /WDSClientUnattend:WDSClientUnattend\Unattend.xml

Note

For more information about approving pending computers, see How to Manage Client Computers (https://go.microsoft.com/fwlink/?LinkID=115265).

  • Associate the client unattend file for all architectures. You can associate a default client unattend file for all booting clients based on the architecture. If you choose this option, you will not be able to deploy any other images from that server. That is, you will not be able to deploy any .wim or .vhd images except for the image that is referenced in the unattend file. To associate an unattend file, use the following procedure or run WDSUTIL /Set-Server /WDSUnattend /Policy:enabled /File:wdsclientunattend\unattend.xml /Architecture:<arch>.

    To associate a client unattend file by architecture

    1. Copy the client unattend file to RemoteInstall\WDSClientUnattend.

    2. Open the Windows Deployment Services MMC snap-in, right-click the server that contains the image that you want to associate the unattend file with, and then click Properties.

    3. On the Client tab, select Enable unattended installation, browse to the appropriate unattend file, and then click Open.

    4. Click OK to close the Properties page.

Image Unattend File

Next create an image unattend file, which automates the later phases of setup (for example, offline servicing, Sysprep specialize). Reference the Windows Automated Installation Kit for information about the settings in this file, and or example files, see Sample Unattend Files (https://go.microsoft.com/fwlink/?LinkId=122642). Once you have created the file, associate it with an image using the following procedure.

To associate an image unattend file with an image

  1. Click Start, right-click Command Prompt, and then click Run as administrator.

  2. To associate the file, use the following syntax: WDSUTIL /set-Image /Image:<image name> [/Server:<servername>] /ImageType:install /ImageGroup:<name> [/Name:<image name>] /UnattendFile:<full path>

    Example: WDSUTIL /set-Image /Image:"VHD image" /ImageType:install /ImageGroup:”VHD image group” /UnattendFile:"\\server\share\unattend.xml"

After you have configured both unattend files, you are ready to deploy an image using the steps in Deploying an image . If you want, you can follow the instructions in the next section to configure multicasting for your .vhd images.

Creating a multicast transmission for a virtual hard disk image

Optionally, you can create multicast transmissions for your .vhd images in the same way that you can for .wim images (except you can only create the transmissions from the command line). If you do not want to transfer the image using multicasting, you can skip this step. For more information about multicasting with Windows Deployment Services, see https://go.microsoft.com/fwlink/?LinkId=89225.

To create a multicast transmission

  1. Click Start, right-click Command Prompt, and then click Run as administrator.

  2. Do one of the following:

    1. To create an Auto-Cast transmission, use the following syntax: WDSUTIL /New-MulticastTransmission /Image:<image name> /FriendlyName:<friendly name> /ImageType:Install /ImageGroup:<Image group name> [/FileName:<file name>] /TransmissionType:AutoCast.

      Example: WDSUTIL /New-MulticastTransmission /Image:WindowsServer2008R2 /ImageType:Install /ImageGroup:”VHD Image Group” /FileName:install.vhd /TransmissionType:AutoCast

    2. To create a Scheduled-Cast transmission, use the following syntax: WDSUTIL /New-MulticastTransmission /Image:<image name> /FriendlyName:<friendly name> /ImageType:Install /ImageGroup:<Image group name> /TransmissionType:ScheduledCast [/Time:<yyyy/mm/dd:hh:mm>][/Clients:<no of clients>].

      Example: WDSUTIL /New-MulticastTransmission /Image:WindowsServer2008R2 /ImageType:Install /ImageGroup:”VHD Image Group” /TransmissionType:ScheduledCast /Time:"2008/01/20:17:00" /Clients:10

Deploying an image

Now that you have images on the server, and you have configured an unattended installation, you are ready to boot and install this image. The .vhd image file will be deployed to the client. During the initial stages of .vhd deployment, the installation progress screen on the destination computer is identical to the screen when deploying .wim images. Users will observe the initial setup progress screen that lists progress on steps such as “Copying files…” and “Expanding files…”. The difference with this method is that only the .vhd file is copied to the computer and there is no file expansion.

To deploy an image

  1. Configure the BIOS of the computer to enable PXE booting, and set the boot order so that it is booting from the network first.

  2. Restart the computer, and when prompted, press F12 to start the network boot.

  3. The installation will proceed using the settings from the unattend files.

  4. When the installation is completed, the computer will restart and Setup will continue.

Other supported commands

This section lists the other actions that you can perform to manage your .vhd images.

  • To remove a .vhd image from the server, use the following syntax: WDSUTIL /remove-Image /Image:<image name> /ImageType:install /ImageGroup:<image group name>.

    Example: WDSUTIL /Remove-Image /Image:"R2 with Office" /ImageType:Install /ImageGroup:ImageGroup1 /Filename:install.vhd

  • To view metadata for a .vhd image, use the following syntax: WDSUTIL /get-Image /Image:<image name> [/Server:<server name>] /ImageType:install [/ImageGroup:<name of image group>] [/Filename:<filename>].

    Example: WDSUTIL /Get-Image /Image:"R2 with Office" /Server:MyWDSServer /ImageType:Install /ImageGroup:ImageGroup1 /Filename:install.vhd

  • To display information about all images in an image group, use the following syntax: WDSUTIL /Get-ImageGroup /ImageGroup:<image group name> [/Detailed].

    Example: WDSUTIL /Get-ImageGroup /ImageGroup:imagegroup1

  • To modify metadata about a .vhd image, use the following syntax: WDSUTIL /set-Image /Image:<image name> [/Server:<servername>] /ImageType:install /ImageGroup:<name> [/Name:<image name>] [/Description:<image description>] [/UnattendFile:<full path>] [/Security:<SDDL>] [/Enabled:{yes | no}].

    Example: WDSUTIL /set-Image /Image:"R2 with Office" /ImageType:install /ImageGroup:ImageGroup1 /Enabled:no

  • To export a .vhd install image, use the following syntax: WDSUTIL /export-Image /Image:<image name> [/Server:<server name>] /ImageType:install [/ImageGroup:<image group name>] [/Filename:<filename>] /DestinationImage /FilePath:<file path and name> [/Name:<name>] [/Description:<description>] [/Overwrite:{yes | no | append}].

    Example: WDSUTIL /export-Image /Image:"R2 with Office" /ImageType:install /ImageGroup:ImageGroup1 /DestinationImage /FilePath: \\MyServer\Share\NewInstall.vhd /Overwrite:yes

Parameters

The following table describes the parameters used in the previous sections.

Parameter Description

/ImageFile:<file path>

Specifies the full path and file name of the .vhd file. For differencing disks, the path to the image should be to the .vhd file of the differencing disk and not to the parent disk. Adding the differencing .vhd will add the parent .vhd file to the server, but only the differencing disk will be active (the parent .vhd will be inactive). If the differencing disk is part of a chain, choose the last .vhd in the chain. In that case, the immediate parent .vhd and all preceding parent .vhd files in the chain will also be added.

/Image:<image name>

Specifies the name of the image on the Windows Deployment Services server. This is the name that the server automatically assigns the image, unless you change it. To view the image name, run WDSUTIL /Get-ImageGroup /ImageGroup:<image group name>.

[/Server:<Server name>]

Specifies the name of the server. This can be either the NetBIOS name or the fully qualified domain name (FQDN). If a server name is not specified, the local server will be used.

/ImageType:Install

Specifies that the image is an install image.

[/ImageGroup:<Image group name>]

Specifies the name of the image group. This image group cannot contain .wim images. If more than one image group exists on the server, you must specify the image group. If this is not specified and an image group does not already exist, a new image group will be created. Otherwise, the existing image group will be used.

[/Filename:<Filename>]

Specifies the file name for the image file. If the image cannot be uniquely identified by name, you must specify this option. When adding .vhd images, if no file name is specified, the source image file name will be used. When renaming differencing disks, this option only renames the last differencing disk (not the parent .vhd).

/DestinationImage

Sets the parameters for the destination image as follows.

  • /FilePath:<file path and name>. Specifies the full file path for the new image. For differencing disks, the last child is copied to the file path and name. Its parents are also copied to the file path. Unique numbers are appended to the file name for each parent in child-to-parent order. For example, filename-(1), filename-(2).

  • [/Overwrite:{yes | no }]. Determines whether the file specified in the /DestinationImage option will be overwritten if an existing file with that name already exists at the /FilePath. For differencing disks, this option also applies if there is a duplicate name for an implicitly renamed parent.

[/UnattendFile:<Unattend file path>]

Sets the full path to the image unattend file to be associated with the image. For differencing disks, all parent images are associated with the same unattend file. In addition to this file, you must also create and configure a Windows Deployment Services client unattend file.

Sample client unattend file for .vhd deployment

The following is a Windows Deployment Services client unattend file that you can use when deploying a .vhd image. The file contains all of the standard attributes that are needed to automate the user interface screens; however, you must modify this file for your environment. For more information about unattended installations, see Performing Unattended Installations (https://go.microsoft.com/fwlink/?LinkId=89226).

<?xml version="1.0" ?> 
<unattend xmlns="urn:schemas-microsoft-com:unattend">
   <settings pass="windowsPE">
      <component name="Microsoft-Windows-Setup" publicKeyToken="31bf3856ad364e35" 
language="neutral" versionScope="nonSxS" processorArchitecture="amd64">
         <WindowsDeploymentServices>
            <Login>
               <WillShowUI>OnError</WillShowUI>
               <Credentials>
                     <Username>username</Username>
                     <Domain>Fabrikam.com</Domain>
                     <Password>my_password</Password>
                  </Credentials>
               </Login>
            <ImageSelection>
               <WillShowUI>OnError</WillShowUI>
               <InstallImage>
                  <ImageName>WindowsServer2008R2</ImageName>
                  <ImageGroup>VHD Image Group</ImageGroup>
                  <Filename>Install.vhd</Filename>
               </InstallImage>
                  <InstallTo>
                  <DiskID>0</DiskID>
                  <PartitionID>1</PartitionID>
               </InstallTo>
            </ImageSelection>
         </WindowsDeploymentServices>
         <DiskConfiguration>
            <WillShowUI>OnError</WillShowUI>
               <Disk>
                  <DiskID>0</DiskID>
                  <WillWipeDisk>false</WillWipeDisk>
                  <ModifyPartitions>
                     <ModifyPartition>
                        <Order>1</Order>
                        <PartitionID>1</PartitionID>
                        <Letter>C</Letter>
                        <Label>TestOS</Label>
                        <Format>NTFS</Format>
                        <Active>true</Active>
                        <Extend>false</Extend>
                     </ModifyPartition>
                  </ModifyPartitions>
            </Disk>
         </DiskConfiguration>
      </component>
      <component name="Microsoft-Windows-International-Core-WinPE" publicKeyToken="31bf3856ad364e35" 
language="neutral" versionScope="nonSxS" processorArchitecture="amd64">
         <SetupUILanguage>
            <WillShowUI>OnError</WillShowUI>
            <UILanguage>en-US</UILanguage>
         </SetupUILanguage>
         <UILanguage>en-US</UILanguage>
      </component>
   </settings>
</unattend>