Deploying Generation 2 VMs with PowerShell Deployment Toolkit (PDT)

Rob Willis has just released the latest version of his PowerShell Deployment Toolkit (PDT) and with it a new VMCreator script that allows you to deploy Generation 2 virtual machines. Before you can deploy your Generation 2 virtual machines, you’ll need to use the Convert-WindowsImage PowerShell script to create your template/parent VHD. Generation 2 virtual machines are only supported on Windows Server 2012 R2 and Windows 8.1 virtual machines, so you can use your existing Windows Server 2008 R2 parent VHD for the Service Manager SharePoint Self-Service portal.

To create a new Generation 2 vhdx, I used the following command line and saved it as a PowerShell script CreateGen2VM.ps1. You will notice that to create a Generation 2 vhdx, you add an additional parameter –VHDPartitionStyle GPT.

.\Convert-WindowsImage.ps1 -SourcePath V:\ISO\Windows_Server_2012_R2-Evaluation-Datacenter_Edition–EN-US-X64.ISO -VHDPath S:\VHD\WS12R2DG2.vhdx -SizeBytes 40GB -VHDFormat vhdx -VHDType Dynamic -VHDPartitionStyle GPT -Edition ServerStandardEval

Several changes need to be made to the Variable.xml to enable Generation 2 VM deployment. To enable Generation 2 for all VMs deployed with VMCreator, add the following to the VMs Default section.

<VMs>
<Default>
<VMGeneration>2</VMGeneration>

If you are deploying a Windows Server 2008 R2 virtual machine for the Service Manager SharePoint Self-service portal, you will need to set the VM to Generation 1, since Gen 2 is not compatible with WS2008.

The configuration for this vm will look like this:

<VM Count=”14″>
<VMName>SM03</VMName>
<VMGeneration>1</VMGeneration>
      <NetworkAdapter>
<Identifier>Local Area Connection</Identifier>
</NetworkAdapter>
<OSDisk>
<Parent>S:\VHD\WS08R2E-SP1.vhdx</Parent>
<Type>Differencing</Type>
</OSDisk>
</VM>

Once you have your new Generation 2 Vhdx, time to build a new System Center 2012 R2 lab with PDT 2.6!

One thought on “Deploying Generation 2 VMs with PowerShell Deployment Toolkit (PDT)

  1. Pingback: Convert-WindowsImage.ps1 | | test

Leave a Reply