Deployment–VMCreator updates with PDT 2.6

PowerShell Deployment Toolkit 2.6 (PDT), which is available on the TechNet Gallery here, added new capabilities for VM Creation:

  • Generation 2 VMs
  • VLAN Tagging
  • MAC Spoofing
  • Autostop Settings
  • Guest Services

As a reminder, VMCreator.ps1 was introduced in this post.  The PDT download includes a sample Variable.xml file that includes a <VMs> section that defines how VMs are created.  The new capabilities are all defined by additional tags in the <VMs> section either in the <Default> section to be used by all VMs or in each individual <VM> section.

The new tags are:

Generation 2 VMs

To create a generation 2 VM include this in the main section for <Default> or each individual <VM>, at the same level as <VMName>.

<VMGeneration>2</VMGeneration>

There are several conditions for this to work correctly – the Hyper-V host must be running Windows Server 2012 R2, and the parent OSDisk must be suitable for a generation 2 VM.  You can use the current version of Convert-WindowsImage.ps1 – available on the TechNet Gallery here – to create an appropriate parent OSDisk.

VLAN Tagging

To set a VLAN ID on the virtual network adapter for a VM include this in the <NetworkAdapter> section either in the <Default> section to be used by all VMs or in each individual <VM> section…

<VLANID>x</VLANID>

…replacing x with the appropriate VLAN ID.

MAC Spoofing

To set MAC Spoofing on the virtual network adapter for a VM include this in the <NetworkAdapter> section either in the <Default> section to be used by all VMs or in each individual <VM> section.

<MACSAddresspoofing>True</MACAddressSpoofing>

Note that MAC Spoofing is required on any VM that is going to part of a network load balancer (NLB) configuration.

Autostop Settings

To configure the automatic stop action on a VM include this in the main section for <Default> or each individual <VM>, at the same level as <VMName>.

<Autostop>setting</AutoStop>

Valid values for “setting” are TurnOff, Save, and ShutDown with the default value being Save.

Guest Services

To enable guest services – the Windows Server 2012 R2 feature also known as “enhanced session mode” – include this in the main section for <Default> or each individual <VM>, at the same level as <VMName>.

<GuestServices>True</GuestServices>

There are several conditions for this to work correctly – the Hyper-V host must be running Windows Server 2012 R2, and Enhanced Session Mode must be enabled in Hyper-V Settings for the host.