My Automation Framework based upon MDT works on all the major hypervisors from Citrix, Microsoft, Nutanix and VMware. The biggest pain point for me conduction tests on XenServer is the lack of support for Windows Pre-installation Environments also know as WinPE. I have tried many time together with other community friends without any luck. At the end I just gave up and excepted the slowness.
Yesterday I got that A-HA moment thanks to the post Improve MDT Network Performance on XenServer by Tim Riegler. That was the fire I needed to revisit the problem and figure it out once and for all.
I’m also in the process of rewriting the lab guides for my Automation Framework Master Class in Copenhagen and this bug really slows things down. Read along to learn more, I was actually so eager to get this out in the wild that I woke up at 04:00 am this morning.
Why doesn’t it work?
The Citrix XenServer WinPE drivers has been created in a very strange way. When working with drivers in MDT, especially WinPE we want to add as few drivers as possible. Below is the drivers I’m currently using for Citrix & VMware (Nutanix needs to be added manually because it has conflicts and will BSOD Windows 2012 R2).
When you boot up on the boot ISO you can verify that the Realtek drivers is used instead of the Citrix Paravirtualized driver as shown below.
Hey dude, your missing some drivers. Yes I know, let’s be quick and dirty and just import all the x86 and x64 drivers from C:\Program Files\Citrix\XenTools\Drivers.
Now let update the boot ISO by right clicking the deployment share and select Update Deployment Share – Completely regenerate the boot images.
Copy the new boot ISO to your ISO repository and start the VM again.
WHAT! Not again…
So all the confusion here is because by default MDT is using the All Drivers profile, but only Includes drivers for network and mass storage are selected.
Guess what, to get Citrix XenServer working you need Include all system-class drivers in the selection profile.
What’s the reason for this going wrong for some many experts?
In my case the problem was missing a driver even though I had a Selection Profile with Include all drivers from the selection profile selected. For others I guess they had all the drivers imported, but didn’t have Include all drivers or the System-Class drivers selected. I told you it was Stranger Things.
Now let update the boot ISO once again by right clicking the deployment share and select Update Deployment Share – Completely regenerate the boot images.
What’s the impact?
It’s HUGE, the first stage of a MDT deployment copies the OS WIM which is at least 4GB, so a fast deployment requires a fast network and multiple vCPUs. Let’s look into some stats.
1 vCPU – 2GB of Memory
XS Realtek // Complete DC deployment 24:39 // 0-100% 07:04
XS Paravirtualized // Complete DC deployment 21:10 // 0-100% 03:42
2 vCPU – 2GB of Memory
XS Realtek // Complete DC deployment 23:22 // 0-100% 06:47
XS Paravirtualized // Complete DC deployment 19:30 // 0-100% 03:12
It might seems like a small different at first glance, but be aware that I didn’t test with Package Updates. My PoC deployment went from 2 to 1 hour while Tim reports going from 8 to 2 hours total.
There seems to be mixed results in the community, so below is a PowerShell script to automate the process. I also suspect that the latest version of Windows Assessment and Deployment Kit (Windows ADK) is required, which explains the mixed results. Please uninstall, download and install the latest version.
Write-Verbose "Setting Arguments" -Verbose
$StartDTM = (Get-Date)
$Source = "C:\Source"
$Target = "C:\Hydration"
$Share = "Hydration$"
$WIM = "D:\Sources\install.wim"
Import-Module "C:\Program Files\Microsoft Deployment Toolkit\bin\MicrosoftDeploymentToolkit.psd1"
New-PSDrive -Name "DS001" -PSProvider MDTProvider -Root "C:\Hydration"
new-item -path "DS001:\Out-of-Box Drivers" -enable "True" -Name "WinPE 5.0 x64" -Comments "" -ItemType "folder" -Verbose
new-item -path "DS001:\Selection Profiles" -enable "True" -Name "WinPE 5.0 x64" -Comments "" -Definition "<SelectionProfile><Include path=`"Out-of-Box Drivers\WinPE 5.0 x64`" /></SelectionProfile>" -ReadOnly "False" -Verbose
$uri = "http://xenapptraining.s3.amazonaws.com/Hydration/Drivers.zip"
$PackageName = $uri.Substring($uri.LastIndexOf("/") + 1)
Invoke-WebRequest -Uri $uri -OutFile "$Source\$PackageName"
Expand-Archive -Path $PackageName -DestinationPath .\
New-PSDrive -Name "DS001" -PSProvider "MDTProvider" -Root $Target
import-mdtdriver -path "DS001:\Out-of-Box Drivers\WinPE 5.0 x64" -SourcePath "$Source\Out-of-Box Drivers" -Verbose
$xmlfile = "$Target\Control\Settings.xml"
$xml = [xml](Get-Content $xmlfile)
$xml.Settings.'Boot.x64.IncludeAllDrivers' = "True"
$xml.Settings.'Boot.x64.SelectionProfile' = "WinPE 5.0 x64"
Write-Verbose "Updating Deployment Share" -Verbose
update-MDTDeploymentShare -path "DS001:" -Force
Write-Verbose "Stop logging" -Verbose
$EndDTM = (Get-Date)
Write-Verbose "Elapsed Time: $(($EndDTM-$StartDTM).TotalSeconds) Seconds" -Verbose
Write-Verbose "Elapsed Time: $(($EndDTM-$StartDTM).TotalMinutes) Minutes" -Verbose
It turns out that it’s only the 8.1.0 driver from XenServer Tools 7.0 that works.