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:

image

  • 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.
    • computerName – specifies whether “Change computer name” VmConfig task must be executed during VPS provisioning or not. “true” means task will be executed;
    • administratorPassword – specifies whether “Change administrator password” VmConfig task must be executed during VPS provisioning or not. “true” means task will be executed;
    • 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.