dnp_logo_big.png

 

 

 

Preparing DotNetPanel VPS Templates with Windows Server 2008

 

 

 

 

DotNetPanel VPS Solution Guides

Wednesday, 9 December 2009

Version: 1.2


 

Table of Contents

1      Introduction. 3

2      Overview.. 3

3      Managing Hyper-V Server 4

4      Creating “Master” Virtual Machine. 5

5      Installing Guest Operating System.. 7

6      Setting up Guest OS Services and Applications. 10

6.1      Hyper-V Integration Services. 10

6.2      Change Computer Name. 11

6.3      Configure Network Connection. 11

6.4      Enable Remote Desktop. 11

6.5      Set password policy. 11

6.6      Backup Master VHD.. 12

6.7      Install DNP Virtual Machine Configuration Service. 12

7      Preparing VPS Template for Deployment 14

7.1      Sysprep Utility. 14

7.2      Creating Answer File for Sysprep. 14

7.3      Generalize Master Image. 17

8      Deploying VPS Template to Library. 19

8.1      Replace Answer File with Template. 19

8.2      Create Templates Index File. 22

9      VPS Guest OS Provisioning. 25

10    Summary. 26

11    Changes History. 26

 


 

1            Introduction

The process of deployment of Virtual Private Servers (VPS) to end customers is very similar to deployment of dedicated servers.

Installing guest Operating System on every purchased VPS from scratch is time-consuming process which leads to order delivery delays (some hosting companies may setup new VPS up to 48 hours) and potentially leads to security breaches as a result of configuration errors and human factor.

The goal of every VPS hosting company is to minimize VPS provisioning time (up to several minutes if possible!), reduce administrative overhead and exclude human factor. This could be achieved by creating a new VPS from “operating system template” (OS template) once prepared by highly-skilled personnel.

In DotNetPanel (DNP) VPS solution OS template represents a set of Virtual Hard Disk (VHD) file containing “generalized” image of installed OS (and other applications) and a meta-information describing template supported features as well as provisioning options.

In this article we will demonstrate how to prepare OS template ready for completely automated provisioning of customer VPS with Windows Server 2008 or Windows Vista.

2            Overview

The process of creating a new VPS template for DNP solution could be outlined by the following diagram:

Step

Description

Create “Master”

Virtual Machine

Create a new “master” virtual machine. Its’ Virtual Hard Drive (VHD) with pre-installed operating system and other software will be used as a template for customer virtual machines.

Install Guest

Operating System

Install desired operating system on “master” virtual machine. Configure operating system settings, services and install additional applications.

Install Hyper-V

Integration Services

Install Hyper-V Integration services including drivers for virtual hardware, mouse support and integration components.

Install

DNP VmConfig Service

Install DotNetPanel Virtual Machine Configuration Service (DNP VmConfig) to execute various provisioning tasks and gather real-time statistics.

Sysprep

“Generalize” pass

Generalize “master” operating system with Sysprep utility and prepare it for multi-copying.

Replace Unattended answer file with template

Copy “master” VHD to DNP Templates library, mount it and replace unattended Setup answer file with template. Setup other installation scripts if required.

Deploy VHD to DNP Templates Library

Add a new template “item” into Template library index file, describe template supported features and provisioning options.

 

This document covers every step in more details below.

3            Managing Hyper-V Server

It is more suitable to work with VHD and virtual machines on full Windows Server 2008 with Hyper-V role installed.

However, if you have remote Hyper-V Server 2008 or Windows Server 2008 Server Core installed you could use “Hyper-V Remote Management Update for Windows Vista (KB952627)”: http://www.microsoft.com/downloads/details.aspx?FamilyID=BF909242-2125-4D06-A968-C8A3D75FF2AA&displaylang=en

For 64-bit Vista:
http://www.microsoft.com/downloads/details.aspx?familyid=88208468-0AD6-47DE-8580-085CBA42C0C2&displaylang=en

Important notes regarding this update:

1.     It doesn’t work on Windows Vista Home Basic or Premium editions.

2.     You should enable “Administrative Tools” menu item:



To enable “Administrative Tools” menu right-click on Task Bar -> “Properties” menu item -> “Start menu” tab -> “Customize...” button.

For complete Windows Server 2008 remote management you could use “Microsoft Remote Server Administration Tools for Windows Vista (KB941314)”: http://www.microsoft.com/downloads/details.aspx?FamilyID=9ff6e897-23ce-4a36-b7fc-d52065de9960&displaylang=en

For 64-bit Vista:
http://www.microsoft.com/downloads/details.aspx?familyid=D647A60B-63FD-4AC5-9243-BD3C497D2BC5&displaylang=en

Important notes:

1.     It requires Windows Vista Business edition or above

2.     It requires Service Pack 1 installed.

In all our examples below we will be using full Windows installation with Hyper-V role installed.

4            Creating “Master” Virtual Machine

You have to create a “master” virtual machine which will be used to work with template VHD.

To install guest OS on master virtual machine you need .ISO file or physical DVD media with operating system distributive. You can download DVD ISO files from MSDN subscriptions.

Open “Hyper-V Manager” and click “New -> Virtual Machine...” from action menu to start virtual machine creation wizard.

·         Give new VM some meaningful name helping to distinguish it from others, for example “Master - Windows 2008 Standard x64”. We recommend to establish some VM naming conventions, such as “Master - <OS_NAME> <OS_EDITION> <BITNESS> [(INSTALLED_APP_1, INSTALLED_APP_2, ...)], for example to indicate that particular VM is a master VM with Windows Server 2008 Enterprise x64, IIS, SQL Server and DNP installed you could use the following name: “Master – Windows 2008 Enterprise x64 (IIS, SQL, DNP)”.

·         Select VM location. It is recommended to store virtual machines on a separate hard disk volume. It would simplify their backup procedure (VM backup procedure is described in a separate DNP VPS solution guide). For example, in our case the system volume is C: and Hyper-V virtual machines are created on M: volume. Again, we recommend here to define some folders structure, for example customer virtual machines are stored in M:\VPS\Customers folder and master VMs are in M:\VPS\Master folder.



·         Give new VM enough virtual memory to run Windows Server 2008 (at least 512MB).

·         Connect VM to valid external network

·         Create a new virtual hard disk with the minimum space, just enough to install Windows 2008 and other optional applications. Windows Server 2008 requires minimum 10GB, so let’s give it 15GB of free space by specifying this size for new VHD on appropriate wizard step:



·         Select “Install an operating system from a boot CD/DVD-ROM” option and select DVD image file (.ISO) or pass-through physical DVD drive on Hyper-V machine:



·         On the last wizard step select “Start the virtual machine after it is created” option and click “Finish”.

5            Installing Guest Operating System

Just created master VM boots from Windows Server 2008 installation DVD and OS installation process begins:

Note that mouse could not be available at this time as Integration Services must be installed in guest OS to support mouse.

Select required Windows Server 2008 Edition from the list and press “Next” button. In our example we are installing “Windows Server 2008 Standard (Full Installation) x64”.

Follow the rest of wizard steps to install Windows Server 2008:

While installing on every restart VM displays a prompt “Press any key to boot from CD or DVD...” – disregard this message and continue to boot from HDD.

Once Windows Server 2008 installation process is finished OS loads in “Windows Welcome” phase. Specify Administrator account password:

 After completing OS installation you should see “Initial Configuration Tasks” screen:

6            Setting up Guest OS Services and Applications

6.1    Hyper-V Integration Services

The first thing you have to do after OS setup is installing “Hyper-V Integration Services”. Integration services include:

·         Drivers for Hyper-V virtual devices like synthetic network adapter

·         Mouse integration support

·         Windows Services for communicating with host Hyper-V machine:

o    System shutdown

o    Time synchronization

o    Data exchange

o    Heartbeat

o    Backup (VSS)

To install Integration Services remove Windows Server 2008 installation DVD from VM DVD drive by click “Media -> DVD Drive -> Eject”:

Then select “Action -> Insert Integration Services Setup Disk”:

Restart the system after completing the installation of Integration Services.

After successful setup of Integration Services:

·         You are able to use mouse to work with VM through “Virtual Machine Connection”.

·         VM must allow network connectivity as NIC drivers were installed.

·         There are special Hyper-V Windows services running in the guest OS:

6.2    Change Computer Name

Using “Initial Configuration Tasks” wizard change computer name, make it a member of some workgroup or join to Active Directory domain. We recommend selecting meaningful computer name easily distinguishing it from others, for example in our case it might be “MASTER-W2K8-STD”. Note that NetBIOS name is limited to 15 symbols.

Restart computer after changing its name.

6.3    Configure Network Connection

On “Server Manager” home page click “View Network Connections”:

·         Change connection properties to connect network. You might need access to your LAN or Internet to download software distributives and other remote files.

6.4    Enable Remote Desktop

On “Server Manager” home page click “Configure Remote Desktop”:

·         Select “Allow connections from computers running any version of Remote Desktop” as it will allow you to connect from Windows XP, Remote Desktop Web Connection and other RDC-enabled clients.

·         Allow RDC exception on the Firewall

·         Click OK.

6.5    Set password policy

It is recommended policy. You can choose another policy, but anyways DNP Virtual Private Servers Policy should be correlated with those setings.

·         Open Administrative tools > Local Security Policy > Account Policies > Password Policy

·         Press “Enforce password history” and choose 0.

·         Press “Maximum password age” and choose 0.

·         Press “Minimum password age” and choose 0.

·         Press “Minimum password length” and choose some desired valuse. Do not forget ajust DNP Virtual Private Servers Policy to the same value.

·         Press “Password must meet complexity requirements” and choose Disabled.

·         Stay “Store passwords using reversible encryption” with default Disable settings.

·         Click OK.

 

 

6.6    Backup Master VHD

Before moving to the next steps backup your master VHD:

1.     Shut down virtual machine (do not “Turn off” it!).

2.     Locate its .VHD and copy it to some safe location, say to “M:\VPS\Master\Backups” folder. You can see the exact location of VHD file by opening VM properties dialog:

Important note: Do not make system snapshots as it leads to creating differential virtual hard drives (you may check this article for more info about Hyper-V Snapshotting: http://blogs.msdn.com/virtual_pc_guy/archive/2008/03/11/virtual-machine-snapshotting-under-hyper-v.aspx) and as a result master template will be broken into several parts.

After making VHD backup start VM again.

6.7    Install DNP Virtual Machine Configuration Service

DotNetPanel Virtual Machine Configuration Service (DNP VmConfig) is a Windows Service that runs in guest operating system and performs the following functions:

·         Executes provisioning modules to configure guest operating system

·         Gathers real-time statistics (RAM, HDD) that is displayed on DotNetPanel user interface (UI).

The current version of DNP VmConfig includes the following provisioning modules:

·         Change computer name

·         Change administrator password

·         Change network adapter configuration

DNP VmConfig service communicates with host Hyper-V machine through “Hyper-V Data Exchange” integration component, so make sure its service is up and running.

System requirements:

·         Windows XP of any edition, Windows Vista of any edition, Windows Server 2003 of any edition, Windows Server 2008 of any edition

·         .NET Framework 2.0 runtime:

o    Microsoft .NET Framework Version 2.0 Redistributable Package (x86)

o    Microsoft .NET Framework Version 2.0 Redistributable Package (x64)

Note: You don’t need to install .NET Framework 2.0 on Windows Server 2008 as it is installed with OS by default.

Installation instructions:

·         Download the latest version of DNP VmConfig from DotNetPanel web site: http://www.dotnetpanel.com/downloads/?CategoryID=10

Please note you will need to register at www.dotnetpanel.com in order to download files from “VPS Solution” section.

·         Extract the contents of the zip file to the destination directory, e.g. “C:\Program Files\DotNetPanel\VmConfig”.

·         Install VmConfig service using installation batch:

o    In Windows Explorer the destination directory in which DNP.VmConfig.exe executable file is located.

o    Run “install.bat”

·         Open “Services” snap-in by clicking “Start -> Administrative Tools -> Services”. You should see “DotNetPanel Virtual Machine Configuration Service” in the list:



·         Start “DotNetPanel Virtual Machine Configuration Service”.

·         Open DNP.VmConfig.log file and make sure it doesn’t contain any errors. Normally, immediately after service start it must contain the following text:

[11/26/2008 4:53:32 PM] APP: DNP.VmConfig 1.1.0.0 started successfully
[11/26/2008 4:53:32 PM] START: Loading provisioning modules...
[11/26/2008 4:53:32 PM] END: 3 module(s) loaded

7            Preparing VPS Template for Deployment

It may probably seem that once we have a ready master VHD the most straightforward way to create another virtual machine would be just copying this VHD instead of creating it from scratch. But if you do that, the duplicated VHD will contain the same Computer Security Identifier (SID) as the master VHD. If you try to join new system to the domain, you won’t be able to login with the following error message: “The system cannot log you on due to the following error: The name or security ID (SID) of the domain specified is inconsistent with the trust information for that domain.

Microsoft states that “Computers running the Windows operating system use a Security ID (SID) to uniquely identify themselves. When you use disk-duplicating software, it is important to take steps to ensure the uniqueness of these Security IDs.

7.1    Sysprep Utility

Sysprep prepares a computer for disk imaging or delivery to a customer by configuring the computer to create a new computer security identifier (SID) when the computer is restarted. In addition, Sysprep cleans up user- and computer-specific settings and data that must not be copied to a destination computer.

Sysprep.exe utility is a part of Windows Server 2008 and it is located in %windir%\system32\sysprep folder (in our case it is c:\windows\system32\sysprep).

You can find more information about Sysprep utlity here: http://technet.microsoft.com/en-us/library/cc766049.aspx

7.2    Creating Answer File for Sysprep

After running Sysprep utility on Master VPS all user- and computer-specific information will be deleted from the operating system. On the next VPS restart operating system will behave much like a fresh OS in the middle of setup process, i.e. it will run “specialize” and then “oobeSystem” (OOBE – out-of-the-box experience) passes. User will be asked to select computer locale and regional settings, specify computer name and set administrator password. But our goal is to hide this process from VPS customers and specify (“answer”) all these parameters on their behalf.

More information about how Windows Setup configuration passes work:
http://technet.microsoft.com/en-us/library/cc749307.aspx

To automate Windows Setup we provide Sysprep utility with an “answer file” to configure unattended Setup settings for various passes. Answer file represents an XML file with clear and well-documented structure. This file could be conveniently edited in Windows System Image Manager (WSIM) tool that is a part of Windows Automated Installation Kit (WAIK).

You can download WAIK from Microsoft Downloads or MSDN Subscription Downloads. We recommend downloading WAIK from MSDN as it perfectly works on 64-bit systems.

WAIK ISO from Microsoft Downloads is available at: http://www.microsoft.com/downloads/details.aspx?FamilyID=94bb6e34-d890-4932-81a5-5b50c657de08&DisplayLang=en

WAIK could be installed on both Windows Vista and Windows Server 2008.

To unpack ISO file without burning it onto DVD you may use “7Zip” file archiver that is free and available for download here: http://www.7-zip.org/

In order to create an answer file you will also need a copy of install.wim file that is available in “Sources” folder of Windows Server 2008 installation DVD. In order to create a catalog from install.wim image file WSIM must have a write access to the folder where it is located, so copy this file from DVD to some folder on the hard drive (say, “c:\WSIM\Windows Server 2008 x64”).

When you start WSIM toll you will see its main window with several panes:

The first step is to create a catalog from image file. Select “Tools -> Create Catalog” from the top menu. Select install.wim file and select image to catalog. In our case it is the first option (Windows Server 2008 Standard edition):

 

All possible settings that could be included in the answer file are in the tree in “Windows Image” pane:

The full documentation for Windows Setup configuration settings could be found here: http://technet.microsoft.com/en-us/library/cc749204.aspx

All settings can be applied during various passes of the Windows Setup process. More information about Windows Setup configuration passes:
http://technet.microsoft.com/en-us/library/cc766245.aspx

Strictly speaking, WSIM tool is just a visual editor for editing XML files with tree-view representation. For instance, sample XML answer file that can be downloaded from “VPS Solution” section of our web site (https://www.dotnetpanel.com/downloads/Default.aspx?ID=75). Specifying settings for computer name, administrator password and three network adapters looks in WSIM as following:

7.3    Generalize Master Image

We are going to prepare a very basic answer file just for “generalize” pass which is initiated in the time of Sysprep execution. Later, we will create another answer file with settings for “specialize” and “oobeSystem” phases that will be used by Windows Setup on the first run of new customer VPS.

For “generalize” phase we are disabling auto-starting “Server Manager” application and disabling “Initial Configuration Tasks” dialog:

Save answer file as “unattend-generalize.xml” in “c:\WSIM\Windows Server 2008 x64” folder (where install.wim is located).

You can download this file from “VSP Solution” section of our web site:
https://www.dotnetpanel.com/downloads/Default.aspx?ID=75

In downloaded answer files change all “processorArchitecture” attributes to “amd64” if the file is used with 64-bit editions of Windows and to “x86” if it is used with 32-bit editions.

Also, in “cpi:source” attribute change <EDITION> in “Windows Longhorn SERVER<EDITION>” value to the correct Windows edition value.

Connect to “master” VPS using Remote Desktop or Hyper-V Virtual Machine Connection and copy “unattend-generalize.xml” file to “%windir%\system32\sysprep” folder of guest OS as “unattend.xml”:

Before running sysprep please switch all network adapters of master VM to “Obtain an IP address automatically”.

Open command line interface:

Start -> Run... -> cmd + Enter

Switch to c:\Windows\System32\sysprep directory:

cd c:\Windows\System32\sysprep

Run sysprep with the following parameters:

sysprep /generalize /oobe /shutdown /unattend:unattend.xml

When “master” virtual machine is shut down VPS template is almost ready.

Do not start “master” virtual machine yet!

8            Deploying VPS Template to Library

Copy master VHD file from its original location (in our example it is “M:\VPS\Master\Master - Windows 2008 Standard x64”) to DNP VPS solution “Templates” folder (in our example it is C:\VPS\Templates”) and rename it to “Windows 2008 Standard x64.vhd”.

8.1    Replace Answer File with Template

Using “vmutils” tool that is available on DotNetPanel web site (http://www.dotnetpanel.com/downloads/?CategoryID=10) mount copied VHD:

vmutils MountVHD –path “c:\VPS\Templates\Windows 2008 Standard x64.vhd”

Open “Computer Management” snap-in and expand “Disk Management” node. Bring mounted disk online (if it’s offline):

Alternatively, you could make the disk online and clear volume “readonly” attribute (if set) by using DiskPart utility:

From command line:

C> DiskPart

Display all available disks:

list disk

Select required disk by specifying its index:

select disk=<N>

Bring selected disk online:

online disk noerr

List all volumes:

list volume

Select volume by specifying its index or drive letter:

select volume=<N>

Clear readonly flag:

attributes volume clear readonly noerr

Exit from DiskPart:

exit

In Windows Explorer open “Windows\System32\sysprep” folder on mounted disk.

Download “Sysprep Files for Windows Server 2008” from “VPS Solution” section of our web site (https://www.dotnetpanel.com/downloads/Default.aspx?ID=75) and unpack it to some folder.

Replace contents of “unattend.xml” file in “Windows\System32\sysprep” folder of mounted disk with “unattend-template.xml” from archive.

You can use provided template as a starting point for your own and add any additional settings specific to your hosting company. Do not edit template in WSIM as with template instructions it is in valid XML and thus won’t be loaded by WSIM. Use Notepad or any other text editor. You could find the list of all available template variables in “DotNetPanel VPS Solution Configuration Guide” document.

Also, please note that provided template does not include “ProductKey” element, so you will need to add it in order to skip “Enter product key” dialog during “specialize” pass of Windows Setup. “ProductKey” element must be inserted inside “Microsoft-Windows-Shell-Setup” component, for example:

<component name="Microsoft-Windows-Shell-Setup" ...>

  <ComputerName>#vm.Hostname.ToUpper()#</ComputerName>

  <RegisteredOwner>#user.FirstName# #user.LastName#</RegisteredOwner>

  <RegisteredOrganization>#user.CompanyName#</RegisteredOrganization>

  <TimeZone>Eastern Standard Time</TimeZone>
  <ProductKey>AAAAA-BBBBB-CCCCC-DDDDD-EEEEE</ProductKey>

</component>

Alternatively, in order to test VPS template you could setup template to skip Windows Activation by omitting “ProductKey” element and inserting “Microsoft-Windows-Security-Licensing-SLC-UX” component into answer file:

<settings pass="specialize">

  <component name="Microsoft-Windows-Security-Licensing-SLC-UX" processorArchitecture="#architecture#" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <SkipAutoActivation>true</SkipAutoActivation>

  </component>
  ...
</settings>

Help page for “ProductKey” element: http://technet.microsoft.com/en-us/library/cc749389.aspx

Help page for “SkipAutoActivation” element: http://technet.microsoft.com/en-us/library/cc749137.aspx

Please note, that “ProductKey” and “SkipAutoActivation” elements should not be added both in the answer file, but only one of them: “ProductKey” if guest OS must be activated during the first run and only “SkipAutoActivation” to postpone guest OS activation.

When deploying a new VPS DotNetPanel will mount VHD again and process this template with VPS-specific values.

When the sysprep process is finished “unattend.xml” file won’t be deleted automatically, however it might contain sensitive information (e.g. product key) that should be hidden from user. To delete “unattend.xml” create “SetupComplete.cmd” batch file in “\Windows\Setup\Scripts” folder (create this folder if not exists) and add the following file:

del /F /Q %windir%\system32\sysprep\unattend.xml

You can perform any other post-setup tasks in SetupComplete.cmd, for example change names of network connections:

cscript %windir%\Setup\Scripts\rename-connections.vbs

del /F /Q %windir%\Setup\Scripts\rename-connections.vbs

You can get “rename-connections.vbs” and complete SetupComplete.cmd from “Sysprep Files Pack for Windows Server 2008” on our web site. Don’t forget to add rename-connections.vbs for pre-processing in index.xml (see below).

You can find more information about “SetupComplete.cmd” here:
http://technet.microsoft.com/en-us/library/cc766314.aspx

Unmount VHD using “vmutils” tool:

vmutils UnmountVHD –path “c:\VPS\Templates\Windows 2008 Standard x64.vhd”

8.2    Create Templates Index File

OS Templates folder (in our example “C:\VPS\Templates”) with template .VHD files must contain “index.xml” file which contains the list of all available templates and has the following structure:

<?xml version="1.0"?>

<items>

  <item path="vhd-filename-without-extension"

        diskSize="internal-vhd-size-in-GB"

        legacyNetworkAdapter="true|false"

        remoteDesktop="true|false">

    <name>template name shown in the dropdown</name>

    <description>template description</description>

    <provisioning>

      <sysprep file="path-inside-vhd-1"/>

      <sysprep file="path-inside-vhd-1"/>

      ...

      <sysprep file="path-inside-vhd-N"/>

      <vmconfig computerName="true|false"

                administratorPassword="true|false"

                networkAdapters="true|false" />

    </provisioning>

  </item>

  <item path="item2">

      ...

  </item>

  <item path="item3">

      ...

  </item>

  ...

</items>

·         path – is the name of VHD file without .VHD extension, for example “Windows Server 2008 x64”. This attribute is mandatory.

·         diskSize – the internal size in gigabytes of VHD (the size the first disk volume inside VHD). This value is used during VPS creation. If “HDD” quota allocated to VPS less then specified VHD size then VPS won’t be created and error will be displayed. However, this attribute is optional and if it is not specified or equal to 0 (“zero”) disk size will not be verified during VPS creation.

·         legacyNetworkAdapter – specifies the type of network adapter that will be created in virtual machine: synthetic (for new Microsoft operating systems where “Intergration Services” exist) or legacy (for Microsoft operating systems prior Windows XP and non-Microsoft operating systems like Linux). If "legacyNetworkAdapter" attribute is not specified it is "synthetic" by default.

·         remoteDesktop – specifies whether remote desktop is enabled in guest OS and VPS could be access with Remote Desktop Web Connection (RDWC). If remoteDesktop is “true” a link with RDWC will appear on “General” tab of VPS properties. If this attribute is not specified RDWC link will be hidden by default:

·         name – display name of OS template. This is the value that will be shown in the dropdown on VPS creation wizard.

·         description – description of OS template. Currently it is not used.

·         provisioning – optional element including provisioning options.

·         sysprep – allows to specify a file inside VHD that must be processed during VPS provisioning. The file may contain DNP template variables and instructions. The “file” attribute must specify relative path (without drive letter) to the file inside VHD as DNP accesses only the first VHD volume, for example “\Windows\System32\sysprep\unattend.xml”. There can be any number of “sysprep” elements to process several files.

·         vmconfig – optional element specifying which VmConfig service modules will be executed during VPS provisioning. Using VmConfig on provisioning stage could be helpful if it is hard or even impossible to configure some settings in unattended setup answer file. For example, to configure computer name and administrator password in Windows XP template you could use answer file and network adapters could be configured with VmConfig tool (as it’s quite hard to describe their parameters in the answer file). Other hand, Windows Server 2008 and Windows Vista can be completely configured with answer file (explained in this guide), so this section could be omitted.

o    computerName – specifies whether “Change computer name” VmConfig task must be executed during VPS provisioning or not. “true” means task will be executed;

o    administratorPassword – specifies whether “Change administrator password” VmConfig task must be executed during VPS provisioning or not. “true” means task will be executed;

o    networkAdapters – specifies whether “Setup network adapters” VmConfig task must be executed during VPS provisioning or not. “true” means task will be executed;

Sample “index.xml”:

<?xml version="1.0"?>

<items>

  <!-- Windows Server 2008 -->
  <item path="Windows-Server-2008-STD-x64"

        diskSize="10"

        remoteDesktop="true">

    <name>Windows Server 2008 Standard 64-bit</name>

    <description></description>

    <provisioning>

      <sysprep file="\Windows\System32\sysprep\unattend.xml"/>
      <sysprep file="\Windows\Setup\Scripts\rename-connections.vbs"/>

    </provisioning>

  </item>

  <!-- Windows Server 2003 -->

  <item path="Windows-Server-2003-ENT-x86"

        diskSize="8"

        remoteDesktop="true">

    <name>Windows Server 2003 Enterprise 32-bit</name>

    <description></description>

    <provisioning>

      <sysprep file="\Sysprep\sysprep.inf"/>
      <sysprep file="\Windows\Setup\Scripts\rename-connections.vbs"/>

      <vmconfig networkAdapters="true" />

    </provisioning>

  </item>

  <!-- Windows XP -->

  <item path="Windows-XP-Home">

    <name>Windows XP Home Edition</name>

    <description></description>

    <provisioning>

      <sysprep file="\Sysprep\sysprep.inf"/>

      <vmconfig networkAdapters="true" />

    </provisioning>

  </item>


</items>

When creating index.xml file pay attention to:

·         File extension that must be “.xml”. When you are creating a new .txt file in Windows it may hide known extension, so it might be confusing.

·         File encoding. UTF-8 is recommended to allow various national characters in template names and descriptions. You may choose encoding on “Save as...” dialog of Notepad.

 

9            VPS Guest OS Provisioning

The following diagram outlines VPS guest OS provisioning and it helps to better understand what’s happening when DNP creates a new VPS:

Step

Description

Copy VHD from Templates Library

DNP copies template VHD to customer VPS folder. If required destination VHD is converted either to dynamic or fixed type and then expanded if its size must be greater that OS template.

Process Unattended setup answer template

VHD is mounted and all specified templates are processed by DNP.

Create Customer

Virtual Machine

DNP creates a new virtual machine and attaches copied and processed VHD. New virtual machine is starting.

Windows runs

“Specialize” pass

During first run of operating system Windows Setup process configuration settings from “specialize” pass.

Windows runs

“Welcome” pass

Right after “specialize” pass Windows Setup process configuration settings from “oobeSystem” pass.

DNP VmConfig configures the rest of OS parameters

DNP VmConfig service is starting and executing specified provisioning tasks.

 

10     Summary

This whitepaper described required steps for successful creation of VPS OS template with Windows Server 2008 or Windows Vista. Provided guidance could be used as a good starting point for creation your own OS templates based on Windows Server 2008, but with additional pre-installed software and deployment scenarios.

11     Changes History

Version

Date

Author

Changes

1.0

12/01/2008

Feodor Fitsner

Initial document version.

1.1

12/05/2008

Feodor Fitsner

Added the information about “ProductKey” element in the answer file and skipping Windows Activation process.

1.2

03/16/2009

Feodor Fitsner

Added a note regarding network adapter parameters before doing sysprep.