Search This Blog

Tuesday, September 2, 2014

Create Virtual Machine Using PDT

In this post we are going to look on another alternative way to create virtual machine. The tool that we are going to use is Microsoft Powershell Deployment Toolkit (PDT). We have modified the default PDT variable to just use it for

  • Provisioning a virtual machine with different configuration
  • Assign IP Address
  • Join to Domain

This come handy when you just would like to provisioning several virtual machine without install any roles/application and then pass Application team for application deployment.


a) Windows Server 2012 R2 Hyper-V

b) Downloaded PDT from Technet Gallery:- Click here

c) Base image either Windows Server 2008 R2, Windows Server 2012 or Windows Server 2012 R2. You can refer to our previous post on how to create

  • Windows Server 2012 or 2012 R2 Sysprep Image – Click here
  • Windows Server 2008 R2 – click here

Note:- Just create a virtual machine, do not run downloader.ps1 and installer.ps1. In this exercise, we are “NOT” setting up System Center deployment.


  • VM Location = C:\VMs
  • Virtual Processor = 2
  • Computer name start with prefix = MS4U
  • Dynamic memory =

Startup –1024MB
Min – 512MB
Max – 2048MB
Buffer 20%

  • Virtual Switch = External
  • Assign static IP starting from
  • Gateway =
  • DNS =
  • Automatic start = nothing
  • Delay = 0
  • Automatic stop = Save
  • DVD = None
  • Additional 1 data disk =Yes
VM Name Processor Memory Data Disk
TestVM1 default default default
TestVM2 default Startup –1024MB
Min – 512MB
Max – 8192MB
Buffer 5%
Create 3 additional disk with each 50GB size
TestVM3 default Startup –2048MB
Min – 2048MB
Max – 2048MB
Buffer 20%
TestVM4 default default default

Modify the default variable.xml or just create a new variable.xml with just below information. Example:- Create 4 Windows Server 2012 R2 Virtual Machine

<?xml version="1.0" encoding="utf-8"?>
<Installer version="2.0">
  <Variable Name="RegisteredUser" Value="Lab" />
  <Variable Name="RegisteredOrganization" Value="MS4U Corporation" />
  <Variable Name="InstallerServiceAccount" Value="icglab\!Installer" />
  <Variable Name="InstallerServiceAccountPassword" Value="P@ssw0rd" />

    <VM Count="1">
    <VM Count="2">
    <VM Count="3">
    <VM Count="4">

Output when execute VMCreator.ps1:-





Above script will create:-

  • Generation 1 VM. To modify to generation 2 VM, on the default section, do add


  • If your base image is dynamic disk, then the target VM will be dynamic disk as well. By default, the script is using differencing disk.


  • The <Count>4</Count> must match to the end value of VM Count :-
  • <VM Count="4">

Please feel free to modify the script according to your environment.