Rapid Provisioning Windows Server 2012 R2 Datacenter Hyper-V hosts using Microsoft Deployment Toolkit (MDT) – Part 1

Share Button

Don’t miss the YouTube video with the results at the bottom!

Over the last several years, I’ve been deploying a LOT of Hyper-V. As a long-time VMware fan, I have to admit, System Center and Hyper-V are sorely lacking in my opinion when it comes to Host Profiles. After all, VMware makes it so easy to deploy with a common set of standard configurations. You drop the installer in, answer a couple easy questions, and within 15 minutes, you typically have a host that has the basic configuration. Then, you can simply attach it to your existing VMware vCenter server, put in Maintenance Mode, attach and apply a host profile. Combine that with Image Builder and Auto Deploy, and you have an even quicker time to value.

Hyper-V? Amazing platform in my opinion, especially when you integrate it with Failover Clustering, Cluster Shared Volumes, System Center Virtual Machine Manager, and App Controller. However, with all the progress Microsoft has made over the years, they still haven’t listened to my desperate plea to integrate a Host Profiles oriented approach to provisioning Hyper-V hosts. Sure, the free Hyper-V Server 2012 R2 is pretty simple, with its Server Core platform and basic wizard driven menu, but most customers need the full support of Datacenter or Standard, whether Core or with a GUI. PowerShell is amazing, and it certainly goes a long way to building and configuring standardized Hyper-V hosts. And, with a bit of work, you can certainly use System Center Configuration Manager to deploy your Hyper-V hosts. However, if you’re a consultant like me you need a deployment mechanism that doesn’t take 1-2 days to integrate into the customers’ environment before you’re able to deploy hosts. And you have to assume most customers don’t already have System Center.

This brings me to my obvious conclusion: Use Microsoft Deployment Toolkit (MDT), some fancy scripting and PowerShell to create an easy to deploy, rinse and repeat approach to building Hyper-V hosts. Take it one step further, use the Advanced Configuration -> Media process to build a standard ISO that I can take around to customer environments to fully automate the build process using a standard, repeatable process. Over the next several blog posts, I’m going to show you all the ins and outs of this process, including how I created a custom input menu for MDT to capture various variables. Once these variables are captured, I can reuse them in scripts and processes along the build process to truly create a lite-touch deployment process for Hyper-V hosts. As the title implies, this post series will show you how to Rapid Provision Windows Server 2012 R2 Datacenter Hyper-V hosts using Microsoft Deployment Toolkit (MDT).  Best part is, this tools are all free to use, whether you’re going to integrate with System Center or just want a couple stand-alone hosts.

Let’s get started. For my environment, I’m using HP Blades in a C7000 chassis with Virtual Connect FlexFabric.  If you’re not familiar, FlexFabric combines ethernet and fiberchannel using Converged Network Adapters (CNAs) and FCOE from the blade perspective.  Virtual Connect allows you to carve up the LOMs into four FlexNICs per module, or eight per host. For details, take a look at the Virtual Connect cookbook. My standard Hyper-V blade looks like this:

NIC1 – Mgmt_A (interconnect bay 1 untagged for host management)
NIC2 – Mgmt_B (interconnect bay 2 untagged for host management)
NIC3 – Cluster_A (interconnect bay 1 untagged for cluster and live migration)
NIC4 – Cluster_B (interconnect bay 2 untagged for cluster and live migration)
NIC5 – VM_A (interconnect bay 1 trunk for VM VLANs)
NIC6 – VM_B (interconnect bay 2 trunk for VM VLANs)
FCOE1 – Direct_A (interconnect bay 1)
FCOE2 – Direct_B (interconnect bay 2)

To speed up even the Virtual Connect component of the configuration, I prefer to script the profile creation through SSH.  Below you will find a sample server profile that you can manipulate and modify to configure for Hyper-V hosts.  The order of the NICs is very important as I’m using PowerShell to sort the NICs by Mac address and rename and team appropriately.

add profile mtx1b8hv3r2 -NoDefaultEnetConn -NoDefaultFcConn -NoDefaultFcoeConn NAG=Default
add enet-connection mtx1b8hv3r2 Network=Unassigned PXE=UseBIOS
add enet-connection mtx1b8hv3r2 Network=Unassigned PXE=UseBIOS
add enet-connection mtx1b8hv3r2 Network=Cluster_A PXE=UseBIOS SpeedType=Auto
add enet-connection mtx1b8hv3r2 Network=Cluster_B PXE=UseBIOS SpeedType=Auto
add enet-connection mtx1b8hv3r2 Network=Unassigned PXE=UseBIOS
add enet-connection mtx1b8hv3r2 Network=Unassigned PXE=UseBIOS
add fcoe-connection mtx1b8hv3r2 Fabric=DIRECT_A SpeedType=Preferred
set fcoe-connection mtx1b8hv3r2:1 BootPriority=Primary BootPort=21:23:00:02:ac:00:39:4d BootLun=0
add fcoe-connection mtx1b8hv3r2 Fabric=DIRECT_B SpeedType=Preferred
set fcoe-connection mtx1b8hv3r2:2 BootPriority=Secondary BootPort=20:23:00:02:ac:00:39:4d BootLun=0

add server-port-map mtx1b8hv3r2:1 VLAN2_MGMT_A Untagged=true
add server-port-map mtx1b8hv3r2:2 VLAN2_MGMT_B Untagged=true
add server-port-map-range mtx1b8hv3r2:5 UplinkSet=SUS_A vlanids=1,3-5,24
add server-port-map-range mtx1b8hv3r2:6 UplinkSet=SUS_B vlanids=1,3-5,24

assign profile mtx1b8hv3r2 enc0:8

I’m using “Boot from SAN”, Direct-attached to 3PAR, so if you’re intending to install to local drives modify the boot parameters for FCoE.  This MDT script still applies to rackmount servers, but just keep in mind that it will sort by the MAC address and put the first two into the management team, second two into cluster, and third pair into the VM team.

Let’s move on to the workflow for MDT.  First, I needed to develop a custom wizard to accept all the different variables for the Hyper-V build. Below you will find a screenshot of the finished result:


For this wizard, we need several key pieces of information:

Computer Name:
Management IP Address:
Management Subnet Mask:
Management Default Gateway:
DNS Servers:
Cluster IP Address:
Cluster Subnet:

In my design, I’m using a dedicated layer 2 (non-routed) network for the cluster communications. This can either be an internal or an external network, depending on if you need to cluster more than one C7000 chassis. As such, I don’t want to present a field for “Cluster Default Gateway” as there should only be a single default gateway on Windows systems.

After the user enters the critical variables, the MDT process is based on the Standard Server Task Sequence and will do the following:

– Format, partition, label and install Windows Server 2012 R2 Datacenter
– Rename the server
– Apply Windows Updates (Pre-Application Install)
– Enable Remote Desktop
– Disable the Windows Firewall
– Rename the network adapters to: MGMT_A, MGMT_B, Cluster_A, Cluster_B, VM_A, and VM_B
– Create an LBFO team for MGMT, Cluster, and VM NICs
– Configure IP address, subnet mask, gateway, and DNS for Management team
– Configure IP address and subnet mask for cluster team
– Set DNS registration on the Cluster NICs to false
– Add the MPIO Windows Feature
– Import the MPIO DSMs for all applicable detected devices (3PAR storage)
– Add the Hyper-V role
– Add the Hyper-V RSAT tools
– Add the Failover Clustering feature
– Add the Failover Clustering RSAT tools
– Add the SNMP Service
– Disable IE ESC for Administrators and Users
– Install the HP Smart Update Manager (SUM) using a silent installer
– Reboot and configure the Hyper-V virtual switch for the VM network team
– Apply any additional Windows Updates

In the upcoming posts, I’ll explain how to achieve these results. In the meantime, below you will find a video of the end result. The speed has been accelerated of course for the cooking show effect:

As always, if you have any questions, comments, or just want to leave feedback, please do so below.  Thanks for reading!


Share Button
  1. JDJD03-24-2017

    Hey Dane,

    Did you ever finish this write up or post the scripts online anywhere?


  2. ShuShu11-14-2014

    Hi, Dane,
    Glad to find your video and post online. I’ve been working on an issue during the deployment of Windows 2012 R2 Hyper-V host through MDT 2013 for a while. The physical server I test is HP Proliant DL380 G4. The issue is at the task sequence step to enable Hyper-V. Due to the reason that Hyper-V requires 2 times of reboot in which the 2nd reboot is not supported by MDT TS (http://blogs.technet.com/b/chrad/archive/2011/05/01/enabling-hyper-v-role-successfully-via-operating-system-deployment-task-sequence.aspx) my step of installing Hyper-V role always failed, no matter what tool I used to enable Hyper-V – I tried Powershell, Dism, or the built-in “Install Role and Feature” in MDT.

    Would you share your script or method that you used in the two steps?

    – Add the Hyper-V role
    – Add the Hyper-V RSAT tools

    I appreciate any info you would provide! Thanks!

    • Dane YoungDane Young11-28-2014

      Hi Shu,

      I intend to write a follow-up article to this demo and will share the script at that time.

      Thanks and take care,

  3. Jamie KnowlesJamie Knowles10-27-2014

    Hi Dane, great work with this! I’m just looking into building a load (around 10) of hyper-V hosts for a customer and MDT was my first thought. I’m looking to do the bare metal install of server 2012, configure the network teams and then hyper-v. Second part will be to actually create and install the VMs on the host. I can’t find any futher posts on this. Do you have any example task sequences / scripts you could post?

    • Dane YoungDane Young11-28-2014

      Hi Jamie,

      I am intending to write a follow-up blog post to this demo.


      • RickieRickie06-20-2015

        Hi Dane,

        I’d also be interested in the scripts you used for this MDT deployment. Please let us know if you’re still planning to post a followup?


Leave a Reply