Building an Automated WIM Factory


With Microsoft’s new Windows Update strategy an Automated Build & Capture solution is highly recommended.

I did a post many years ago, but thought it would cool to write a new one that covers all the Hypervisors; Hyper-V G2, XenServer, VMware and Nutanix AHV.

In this setup we’re using Microsoft Deployment Toolkit and a fixed MAC Addresses to seamlessly start the correct Task Sequence. Please refer to the old post Automated Master Image Creation for setup and configuration.

Normally you would add the hypervisor connection details inside the actual PowerShell script, but since there will be one script per Operating System I prefer to use s Settings.xml file to store these settings. However in the case of the ISO image I’m overwriting that variable to use the other ISO.

Microsoft Hyper-V G2

Hyper-V is a bit more complex that I would like, but I guess some of you have some tips to improve this so we can get it 100% automated. At the moment I just paste the code into a RDP session. My problem is PSSession, InvokeCommand and Secure Boot. Anyhow just paste from line 15.

VMware ESXi

Prior to running the script you’ll need to download and install VMware PowerCli.



Citrix XenServer

Prior to running the script you’ll need to install XenCenter, download the XenServer SDK, extract it and copy .\XenServerPSModule to C:\Program Files\WindowsPowerShell\Modules.

You’ll also need to create a VM template called MDT Template 32GB with the MDTBuildLab_x64.iso but without a network interface.



Nutanix AHV

Prior to running the script you’ll need to install the Nutanix Cmdlets.

Create a boot image that contains the Fedora Drivers. The Nutanix Virtio drivers doesn’t work with Windows PE.

Upload to ISO image

You will also need to connect through Putty to get the Network UUID.



The script above do miss the Power-State Loop, but I didn’t have time to finished that up. Please share if you figure it out.


Automation Framework Community Edition

The fastest way to build your lab environment.

Virtual Expo

Friday 30th of September 2022

Leave a Comment