When deploying a new computer or server image using MDT / SCCM, one of the most time consuming parts is Windows Update. So if the reference image isn’t getting updated on a regular basis, the deployment time will increase each and every month.
To achieve the fastest deployment the reference image should be automatically updated with the recent Windows Updates at least once a month.
The recommended platform for building references images is the free Microsoft Deployment Toolkit, even if the images is going to be used with SCCM. So let’s get started with Automated Master Image Creation.
Open CustomSettings.ini for your Build Deployment share and add the following to the top:
1 2 |
[Settings] Priority=MACAddress, Default |
And at the bottom you add a section for each and every OS type you want to automate with the correct MAC Address:
1 2 3 4 5 6 7 8 9 |
[00:15:5D:01:FB:32] SkipTaskSequence=YES SkipCapture=YES DoCapture=YES ComputerBackupLocation=\\mdt-01.ctxlab.local\MDTBuildLab$\Captures BackupFile=W81.wim TaskSequenceID=W81 SkipFinalSummary=YES FinishAction=SHUTDOWN |
If you’re using Windows 2008 R2 or Windows 7 you should add the ProductKey= as well to skip the licensing screen.
To be able to move a captured image to the correct location in a Task Sequence you need to create a script in the scripts catalog, in my case \\mdt-01.ctxlab.local\MDTBuildLab$\Scripts.
Call the script Realocate.cmd and add the following:
1 |
move /Y "\\mdt-01\mdtbuildlab$\Captures\%1.wim" "\\mdt-01\mdtproduction$\Operating Systems\%1" |
And then add a Command Line task at the end with this command:
1 |
cmd /C %SCRIPTROOT%\Realocate.cmd %TaskSequenceID% |
So in the example above, if a computer with the MAC Address 00:15:5D:01:FB:32 boots on the ISO it will automatically start the Task Sequence W81, capture the image, move it to the Production Deployment Share and shutdown the computer.
All this without lifting a finger, a real zero touch deployment. Relax and check the Automated Master Image Creation status now and then from you mobile device.
Wouldn’t it be cool if we could leverage PowerShell to automatically build the master images as a Schedule Task? The following script will create and start a Hyper-V VM with the correct MAC Address and delete it when the capture is finished.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# This script configures the Hyper-V machines # PowerShell 3.0 and Windows Server 2012 or Windows 8 Pro are required to perform this setup. # Variables $CLI1 = "WSUS-W81" # Name of VM running Client Operating System $CRAM = 1GB # RAM assigned to Client Operating System $CLI1VHD = 24GB # Size of Hard-Drive for Client Operating System $VMLOC = "C:\Hyper-V" # Location of the VM and VHDX files $NetworkSwitch1 = "External" # Name of the Network Switch $W7ISO = "\\192.168.1.196\iso\MDTBuildLab_x64_2013.iso" # Windows 7 ISO # Create Virtual Machines New-VM -Name $CLI1 -Path $VMLOC -MemoryStartupBytes $CRAM -NewVHDPath $VMLOC\$CLI1.vhdx -NewVHDSizeBytes $CLI1VHD -SwitchName $NetworkSwitch1 Set-VMNetworkAdapter -StaticMacAddress "00:15:5D:01:FB:32" -VMName $CLI1 # Configure Virtual Machines Set-VMDvdDrive -VMName $CLI1 -Path $W7ISO Start-VM $CLI1 $VM = Get-VM -Name $CLI1 while ($VM.State -ne "off") { write-host "The VM is still running" sleep 30 } # Delete the VM Remove-VM -Name $CLI1 -Force Remove-Item -Recurse -Force $VMLOC\$CLI1.vhdx |
To further improve the building time of the reference images, the captured images should be copied back to the MDT Build Deployment Share once in a while. This way you will update the latest version instead of the base Microsoft ISO image with hundreds of Windows Updates.
So how long does it take to deploy Citrix XenDesktop 7.1 totally automated which Gunnar Berger referred to above? 28 minutes from start to finish, including GPMC and the SCVMM Console.
To further reduce time and space take a look at this article from fellow CTP Aaron Parker : Cleaning up and Reducing the Size of your Master Image.
To learn more check my free training on Automated Master Image Creation.