Michael Niehaus' Windows and Office deployment ramblings
Yes, I’ve been promising this blog posting for quite some time. And I’ve been working on this for quite some time, but kept getting distracted either by new releases (Windows 7, Windows Server 2008 R2, MDT 2010, SCVMM 2008 R2, etc.) or by the addition of new features to the PowerShell scripts that I’ve been using. But I’m determined to get this first part finished today. Shame sometime can be a motivator :-)
First you need some additional background information. I did a presentation at the Microsoft Management Summit, TechEd US, and TechEd Australia where I talked about how to use MDT 2010, ConfigMgr 2007, and SCVMM together for two main purposes:
So this posting is covering the first part, using MDT 2010 Lite Touch together with SCVMM to create an image factory. Here’s more of a logical picture of what I am talking about:
So imagine that you have created a deployment share in MDT 2010 Deployment Workbench, imported your operating systems and all the other required files, and created multiple task sequences to build your reference images. Now you want a quick and easy way to run all of those task sequences, without having a pile of hardware (so virtual machines are good) and without needing to manually initiate the process on each machine (automating the wizard). That’s where the “image factory” comes in.
To implement this, I created a set of PowerShell scripts to initiate the step-by-step process above. The scripts and their purpose:
These scripts need to know some details from your environment. Rather than hard-coding that information in the scripts themselves, this information is stored in a separate XML file named “MDTImageFactorySettings.xml.” This file contains the following settings:
So what is required to set this up in your environment? First, make sure that your environment is functional, as these scripts won’t magically fix things:
Once that’s done, you can perform the following setup steps:
You should then see that connections are made to the MDT deployment share, the MDT database (the settings for the database are retrieved from the deployment share), and the SCVMM server. A virtual machine will be created for each enabled OS deployment task sequence in the specified folder (and subfolders, recursively), and then the specified number of VMs will be started. As the first VMs complete they will shut down (as long as the task sequence finishes successfully) and new ones will be started, until all task sequences are finished.
As part of the VM creation process, new MDT database entries are created specifying the computer settings, associated to the MAC address of the network adapter for that VM. These settings include:
SkipWizard=YES SkipFinalSummary=YES TaskSequenceID=<the ID of the task sequence to run> AdminPassword=P@ssword DoCapture=YES ComputerBackupLocation=<deployment share UNC>\Captures BackupFile=<task sequence ID>.wim FinishAction=SHUTDOWN
So that specifies to skip all the wizards, run a specific task sequence, use a constant local admin password, capture an image to the deployment share using the task sequence ID to name the WIM file, and to shut down the VM when the whole process is complete.
Here’s what you might expect to see while the VMs are being created:
and while they are running:
That display will keep repeating until all task sequences are complete and the virtual machines shut down.
As the virtual machines complete, there will be two “outputs”: the WIM file that is written to the “Captures” directory of the deployment share, and the VHD file that is still attached to the VM. You can turn that VHD into an SCVMM template and use that when creating new VMs. If you do that, be sure to disconnect the ISO file from the virtual DVD drive and to configure the NIC to specify a dynamic MAC address. (More on that topic in a future blog post when we talk about virtual machine customization.)
That’s pretty much the whole process, but it is worth mentioning a few things in closing:
The “Part 2” blog posting will describe how to perform the same scenario using System Center Configuration Manager 2007 (with or without MDT), but it will take me some time to recover from this posting before I get to that one.
If I messed up the instructions or left something out, please let me know via e-mail, mniehaus@microsoft.com. The scripts attached to this blog entry are provided as-is, and are not supported by Microsoft. See the scripts for the full disclaimer.
Ever planning to do that second part? I would still be interested in seeing it.
There are more people here insterested in part two :)
Hi Michael,
I'm seeing a couple of issues with my setup of the Image Factory and was wondering if you could help out. Running the MDTImageFactory.ps1 script from within the SCVMM (2008 R2) does not retain the MDT: PS-Drive and therefore is unable to connect to the SQL Share (My MDT/WSUS instance are running on another 2008 R2 VM hosted off my SCVMM Server, on the same domain). However, when I explore the location of the files and execute the script from there (Right-Click>Run with Powershell), it works almost perfectly. It connects to the share and database, adds the entries into the database and everything.
The other issue that I'm having, which is stopping me from utilizing this awesome solution, is that I can't get it to mount the ISO images to the newly created VM's. The ISO's get copied over properly by the script from the MDT DeploymentShare, but they won't mount. Here is the error message I get:
Creating VM MDT Image Factory WIN7X64
Set-VirtualDVDDrive : Cannot validate argument on parameter 'ISO'. The argument
is null. Supply a non-null argument and try the command again.
At \\SERVERNAME.DOMAIN.COM\MSSCVMMLibrary\PowerShell scripts\ImageFactory.
psm1:125 char:86
+ $null = Set-VirtualDVDDrive -virtualdvddrive $vm.VirtualDVDDrives
[0] -ISO <<<< $vmiso
+ CategoryInfo : InvalidData: (:) [Set-VirtualDVDDrive], Paramete
rBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Syste
mCenter.VirtualMachineManager.Cmdlets.SetDVDCmdlet
Please post part 2. I am very interested.
hello michael
I read an article by interresting cons I wonder if it would apply to our organization. Our goal is to automatically control by MTD building a VM, with the installation of wim image from the information contained in bd MTD (Role, computer). Well sure, the technical platform must be based on an SCVMM server, a server and a host 2010SP1 MTD. Is that the scripts provided as-is allows me to do this project? are there other more detailed articles on the same subject? thank you in advance