Export (0) Print
Expand All

Scenario 2: Deploying Native Boot VHDs Using Windows Deployment Services

Updated: October 15, 2010

Applies To: Windows 7, Windows Server 2008 R2

In Scenario 1, we walked through how to create a VHD, apply an operating system to it, and edit the boot configuration so you can boot into the VHD when you start the computer. In this scenario, we will explore how to deploy VHDs by using Windows Deployment Services, a server role in Windows Server 2008 R2.

If you are already familiar with Windows Deployment Services, you will notice that there is little difference in how you deploy a .vhd file compared to a Windows image (.wim) file. The main difference is how you manage the VHD with Windows Deployment Services because it is currently not possible to use the Windows Deployment Services MMC snap-in to add VHD files to the server. Instead, you will use the WDSUtil command-line tool. In this scenario, you will add a VHD to the Windows Deployment Services server, assign an answer file, and then deploy the VHD to a client computer. To summarize, you will take the following steps:

  • Configure Windows Deployment Services on a server, which includes adding the appropriate “boot image”

  • Create and configure a VHD, similar to the steps you completed in Scenario 1, and then add it to the server

  • Create an answer file and associate it with the VHD

When you are finished with this scenario, the client computer will have a disk layout with two partitions as shown in Figure 4: one that is the system partition where the boot files are stored, and one that is a data partition where the VHD is stored.

Disk layout

Figure 4  Disk layout of the client computer

Scenario prerequisites

Before you proceed, ensure you have the following available:

  • A domain controller running Windows Server 2008 or Windows 2008 R2

  • A DHCP server and a DNS server on the network

  • Windows Deployment Services installed (but not configured) on a computer that is joined to a domain. This scenario assumes that the server has the following configuration:

    • Windows Server 2008 R2 is installed on drive C.

    • Drive D is set up as a separate disk (not a partition). You will use this disk to store data.

    • The Windows Automated Installation Kit (Windows AIK) is installed. If not, see Step 1 of Scenario 1: Configuring Native VHD Boot on a Single Computer.

    • The installation files from Windows 7 Enterprise are copied to the following folder: D:\Sources\Windows 7 Enterprise.

  • A computer on which to install the VHD.

Step 1: Configure Windows Deployment Services

The first step is to complete the setup wizard to configure Windows Deployment Services. To do so, use the following procedure:

To configure Windows Deployment Services

  1. Click Start, click Administrative Tools, and then click Windows Deployment Services. This will open the Windows Deployment Services MMC snap-in.

  2. In the MMC snap-in, click Servers. Windows Deployment Services will try to add any Windows Deployment Services servers that are already installed (if applicable). When your local server name is displayed, select it.

  3. In the right pane, you will see a message that says the server needs to be configured. Right-click the server name, and then click Configure.

  4. Read through the requirements on the Before you begin page, and then click Next.

  5. The data for the Windows Deployment Services server (in our case the VHD and the answer files) need to be stored locally on the server. You configure this location on the Remote Installation Folder Location page. Specify to store the data at D:\RemoteInstall, and then click Next.

  6. Before you bring your Windows Deployment Services server into production, you need to configure how the server will respond to clients that request service. On the PXE Server Initial settings page, you can select one of three choices. Choose Respond to all client computers (known and unknown) because the other options are more advanced and out of scope of this document.

  7. Click Next to apply the initial settings.

  8. On the final page, clear the check box next to Add images to the server now. There is no need to add a .wim file at this time because you will be deploying a VHD file instead. Click Finish to complete the setup.

Step 2: Add a boot image

Besides deploying a VHD, you need a way to boot the client computer to then install the VHD. Adding a “boot image” is a wizard-driven task in Windows Deployment Services. Boot images are files that contain the Windows Preinstallation Environment (Windows PE), a minimal version of Windows that is specially designed for deployment purposes. After you configure Windows Deployment Services (Step 1), you will see several folders on the left pane of the Windows Deployment Services MMC snap-in as shown in Figure 5.

WDS folders

Figure  5  Windows Deployment Services folders

Following is an overview of these folders. The first two folders are those that are important to this scenario:

  • Install Images: This folder contains the operating system images (.wim and .vhd files) that are available to deploy to client computers.

  • Boot Images: This folder lists the boot images, which contain Windows PE.

The following three folders are out of scope for this scenario, but they are listed here in case you are interested in further configuring your server.

  • Pending Devices: Depending on the server’s configuration, client computers that request service appear in this folder. For more information, see Create Pending Devices (http://go.microsoft.com/fwlink/?LinkId=205103)

  • Multicast Transmissions: You can use this folder to configure and maintain multicast transmissions (where an image is transmitted to many clients at one time). For more information, see Performing Multicast Deployments (http://go.microsoft.com/fwlink/?LinkId=205104).

  • Drivers: In Windows Server 2008 R2, you can deploy drivers along with the operating system. You use this folder to configure and maintain drivers. For more information, see Managing and Deploying Driver Packages (http://go.microsoft.com/fwlink/?LinkId=205105).

In the following procedure, you use the Boot Images folder to add a boot image to the server. Later, you will use the boot image when you deploy the VHD to the client computer.

To add a boot image

  1. Right-click the Boot Images folder, and then click Add Boot Image.

  2. When you purchase Windows 7 or Windows Server 2008 R2, two files are included in the Sources folder of the installation media: Boot.wim and Install.wim. Boot.wim is a default version of Windows PE that you will use in this example, and you will use Install.wim later in this scenario. On the Image File page, click Browse, navigate to Boot.wim, and then click OK. Click Next to proceed.

  3. On the Image Metadata page, leave the default text or alter it as appropriate, and then click Next.

  4. On the Summary page, review your settings, and then click Next. The boot image is saved to the RemoteInstall folder and configured for use.

  5. After this process completes, click Finish.

Step 3: Create the VHD

In Scenario 1, you used the user interface (Disk Management) to create a VHD. In this scenario, you will perform the same steps, but you will use the command line. Knowing both methods gives you the flexibility of choosing the way that best fits you. The command-line equivalent of Disk Management is DiskPart.

Alternatively, you could use VHDs that you created by using Hyper-V. Hyper-V is a server role in Windows Server 2008 R2 that you can use to create VHDs and apply operating systems to them. After generalizing the VHDs, you can then use them in virtual environments or for deployment through technologies like Windows Deployment Services.

noteNote
You cannot use VHD files that you created with Virtual PC 2007.

To create a VHD by using the command-line, use the following procedure.

To create a VHD by using DiskPart

  1. To start DiskPart, open an elevated Command Prompt window (click Start, right-click Command Prompt, and click Run as administrator), and then type: diskpart

  2. Type the following commands. These commands create a dynamically expanding VHD with a maximum size of 50 GB, save it as D:\Sources\VHD Files\WIN7WDS.vhd, mount it as drive V, and prepare the file system.

     
    create vdisk file=”D:\Sources\VHD Files\WIN7WDS.VHD” type=expandable maximum=50000 
    select vdisk file=”D:\Sources\VHD Files\WIN7WDS.VHD” 
    attach vdisk 
    Create partition primary 
    Assign letter=v 
    format fs=ntfs quick 
    exit
    

Step 4: Apply a Windows image to the VHD

In Scenario 1, you applied a Windows image (.wim) file to a VHD with the ImageX command-line tool (Step 3). You will perform these same operations in this step.

noteNote
You can use ImageX on computers running Windows 7 or Windows Server 2008 R2 if you have the Windows AIK installed.

To apply the image to the VHD, use the following procedure.

To apply the Windows image to the VHD

  1. Click Start, point to All Programs, and then click Microsoft Windows AIK.

  2. Right-click Deployment Tools Command Prompt, and then click Run as administrator.

  3. In the User Account Control dialog box, click Yes.

  4. Type the following DISM command to view the information about the editions of Windows in the .wim file.

    dism /Get-Wiminfo /Wimfile:”D:\Sources\Windows 7 Enterprise\Sources\install.wim”
    

    There is only one edition of Windows 7 Enterprise available in the .wim file, so you will use an index of 1 in the next step.

    noteNote
    If you want more information about a specific edition of Windows 7 in the .wim, type /Index:<Number> at the end of the previous command.

  5. Now that you have the index number, you can apply the data from the .wim file to the VHD using the following command:

    imagex /apply:”D:\Sources\Windows 7 Enterprise\Sources\install.wim” 1 v:
    

    Wait for the command to finish. The whole process can take 10 minutes or longer depending on the performance of your computer.

  6. You need to detach the VHD before you configure it with Windows Deployment Services. Instead of using Disk Management as you did in Scenario 1, you will use DiskPart. To detach the VHD by using Diskpart, type the following:

    diskpart
    select vdisk file=”D:\Sources\VHD Files\WIN7WDS.VHD” 
    detach vdisk 
    exit
    
    

Step 5: Add the VHD to Windows Deployment Services

In Step 2 of this scenario, you saw that after initializing the Windows Deployment Services server, several default folders were created. One of these folders is the Install Images folder, which is where VHD files that you add will be displayed. Before you can add a VHD to the Install Images folder, you need to create an “image group” within it. This creates a more structured way of maintaining your VHDs.

At this point, you could open the Windows Deployment Services MMC snap-in and use the user interface to add an image group (right-click the Install Images folder and click Add Image Group). However, because you have been using command-line tools, this is a good time to introduce WDSUtil. WDSUtil is more powerful than the MMC snap-in, and it exposes all the features of Windows Deployment Services. To create the image group and add the VHD to it, use the following procedure.

To add the VHD to Windows Deployment Services

  1. Type the following command to create an image group named Virtual Disks. The /verbose and /progress options display extra information during the copy process.

    WDSUtil /add-imagegroup /imagegroup:”Virtual Disks”
    
  2. Use the following command to add the VHD to the image group you just created.

    Wdsutil /verbose /progress /add-image /imagefile:”d:\sources\vhd files\win7wds.vhd” /imagetype:install /imagegroup:”Virtual Disks”
    

This process will take some time; let it finish before you continue with the next step. The output will look similar to Figure 6.

WDSUtil output

Figure 6  WDSUtil output while adding the VHD image

Step 6: Create the answer file

If you started a computer and booted to the network at this time, you would probably see the VHD that you added in the previous step. However, deploying VHDs by using the user interface is not a supported configuration. To deploy a VHD (particularly when you are deploying to more than one computer), you should create an answer file. An answer file is a text file that scripts the answers for a series of user interface dialog boxes, and it is commonly called Unattend.xml.

To create an answer file by using Windows System Image Manager (Windows SIM) from the Windows AIK, use the following procedure.

To create the answer file

  1. To open Windows SIM, click Start, click All Programs, click Microsoft Windows AIK, and then click Windows System Image Manager.

  2. In the Windows System Image Manager window, right-click Select a Windows image or catalog file, and then click Select Windows Image.

  3. You will notice that you cannot select the VHD file from the Select a Windows Image dialog box that appears. You do not want to open a VHD at this point, but instead you want to select a .wim image so that you can use the data within it. Browse to the location where you stored the Windows 7 media (D:\Sources\Windows 7 Enterprise\Sources), and select the catalog file named Install_windows 7 ENTERPRISE.clg. This catalog file contains the state of the settings and packages in the .wim file; the actual file is too large to work with directly.

    noteNote
    If an error message appears that indicates the catalog file is out of date, select the Install.wim file instead and a new catalog will be generated for you.

  4. Now that you can use the data of the image, you can create the answer file. Right-click Create or open an answer file, and then click New Answer File.

    An empty answer file is created with seven components added by default. These components represent the seven stages that a setup can go though. However, not all of the components are applicable at all deployment stages. In this scenario, you will focus on the Windows PE component.

  5. In the left pane of Windows System Image Manager, expand Components, scroll down to Microsoft-Windows-Setup, and expand the node. Right-click WindowsDeploymentServices, and then click Add Setting to Pass 1 WindowsPE. This exposes all the options for the Windows PE component in the answer file. Before the settings are actually written to the file, you have to assign them a value. Use the following tables to create the answer file.

Windows International Core WinPE

 

Property Setting and Value

Windows-International-Core-Winpe

UILanguage = en-US

SetupUILanguage

UILanguage = en-US

Windows Setup Neutral

 

Property Setting and Value

DiskConfiguration

WillShowUI = OnError

Disk[DiskID=”0”]

DiskID = 0

WillWipeDisk = True

CreatePartition[Order=”1”]

Extend = False

Order = 1

Size = 100

Type = Primary

CreatePartition[Order=”2”]

Extend = True

Order = 2

Type = Primary

ModifyPartition[Order=”1”]

Active = TrueFormat = NTFS

Label = System Reserved

Order = 1

PartitionID = 1

ModifyPartition[Order=”2”]

Active = False

Format = NTFS

Letter = D

Order = 2

PartitionID = 2

WindowsDeploymentServices

 

Property Setting and Value

InstallImage

Filename = WIN7WDS.vhd

ImageGroup = Virtual Disks

ImageName = Enterprise_6.1.7200

InstallTo

DiskID = 0

PartitionID = 2

Credentials

Domain = <YourDomain>

Password = <YourPassword>

Username = <YourUsername>

noteNote
If you have worked with answer files, you might notice that the settings in the answer file deploy the VHD to drive D. This is because the drive letter that you assign here will be assigned to the partition where the VHD will be deployed. When deploying VHDs, the VHD needs to be on drive D so the operating system within the VHD can be assigned the drive letter C. This is not a hard technical requirement, but having the operating system on drive C prevents users from being confused and applications from failing—all because the expectation is often that the operating system is located on drive C.

To save your answer file, on the File menu, click Save Answer File, navigate to D:\RemoteInstall\WDSClientUnattend, and then save the file as Autounattend.xml.

Step 7: Associate the answer file

The final step in this scenario is to associate the answer file that you created in Step 6 with the appropriate client computers by using Windows Deployment Services. Associating the answer file configures every applicable computer in exactly the same way. In this scenario, this means that every computer that contacts the Windows Deployment Services server will get two partitions and the VHD will be installed on drive D. You can associate the answer file in two ways:

  1. With the architecture of the computer (x64-based, x86-based, or Itanium-based) by using the Windows Deployment Services MMC snap-in

  2. With an individual computer by using WDSUtil.

This step explains both methods.

The following procedure explains how to associate the answer file with computers that are x86-based.

To associate the answer file with x86-based computers

  1. In the Windows Deployment Services MMC snap-in, right-click the server name, and select Properties.

  2. On the Client tab, select the Enable unattended installation check box.

  3. Click Browse, and then locate the answer file that you stored in the WDSClientUnattend folder. Click Open to return to the Client tab.

  4. Click OK to close the Properties pages.

Associating the answer file with an architecture may work for the majority of your needs, but there are always exceptions where you may want to configure a specific computer with different settings. To associate the answer file with an individual computer, use the following procedure.

noteNote
Before you begin this procedure, make sure that you have the appropriate administrative credentials to create a computer object in Active Directory®.

To associate the answer file with an individual computer

  1. Open a Command Prompt window.

  2. Type the following command with the appropriate UUID for the client computer. You can find the UUID in the BIOS of the computer and you will see it when the computer boots to the network. Alternatively, if the computer has already installed an operating system using Windows Deployment Services, you can find the UUID in the properties of the computer object in Active Directory.

    wdsutil /Add-Device /Device:Computer1 /ID:{The computer’s UUID} /WDSClientUnattend:WDSClientUnattend\WDSUnattend.xml
    
noteNote
For more information about this command, see /add-Device (http://go.microsoft.com/fwlink/?LinkId=205106).

You have now completed all of the steps to deploy the VHD to computers by using Windows Deployment Services. You can now start the computer and boot to the network to install the VHD.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft