Once you have the template VHDX file, keeping it updated can be a challenge, such as
having the latest patches applied. You can generalize an operating system only so
many times, so it is not an option to take a template, start it with a VM, patch it, then
generalize it again with sysprep, and keep repeating this process. There are several
options that I think are good, and I have written instructions for the first two and even
recorded a video for each:
1 . Inject patches into the VHDX file directly using the DISM tool. I created a script to
do this, which is available at:
http://windowsitpro.com/windows/add-updates-offline-vhd-or-wim-file
A video walk-through is available at:
http://www.youtube.com/watch?v=cOUlW2bJnK0
2 . Use a virtual machine and utilize checkpoints to create a point-in-time capture of
the VM before sysprep’ing, applying updates, and sysprep’ing again, and then
export the updated image and revert back to the pre-sysprep’d checkpoint ready for
the next set of updates. I detail this at:
http://windowsitpro.com/hyper-v/easily-maintain-hyper-v-template-image
There is a video walk-through at:
http://www.youtube.com/watch?v=1dddszeRHpM
3 . In the past, Microsoft had the Virtual Machine Servicing Tool (VMST), which
allowed the patching of Hyper-V virtual machines. However, the last supported
version worked only up to SCVMM 2012. Microsoft has now released an updated
solution based on Orchestrator SMA that can patch virtual machines stored in an
SCVMM library from updates available in WSUS. The solution is available at:
http://blogs.technet.com/b/privatecloud/archive/2013/12/07/ orchestrated-vm-
patching.aspx
The solution comes in the form of the SMA runbook and instructions on its usage.
4 . The Windows Server 2012 R2 and above versions of Configuration Manager
support the patching of virtual hard disks. These virtual hard disks can be
published into SCVMM and used as part of a template. More information on using
Configuration Manager for VHD management can be found at
https://technet.microsoft.com/en-us/library/dn448591.aspx.
One option with the template VHDX is to write some basic PowerShell that creates a
new folder for the new VM, copies the template VHDX into that folder, creates a new
VM, and attaches the copied VHDX file to the new VM. It is even possible to mount
the VHDX file and inject a sysprep answer file into it to specify name, domain join
instructions, and even network configuration so that when the virtual machine is
turned on, it is fully configured (which is exactly what SCVMM does).
A better option is to leverage SCVMM, which has full template support and can even