PersistAllDeviceInstalls in Hyper-V Environments

I’ve been creating some images for virtual machine environments.

One of the goals of sysprep is to take all the elements that make an operating system specific to a machine, and make it generic for other machines. However if you know that the hardware is the same, you can tell Sysprep not to strip out the installed device drivers and keep them for the next machine.

There are two ways to persist the devices and drivers when calling sysprep. If you are using Windows 8 or greater, you can add the /Mode:VM switch to the end of the sysprep call. However if you want the process to work in Windows 7 or Windows Server 2008 R2, you need to put the PersistAllDeviceInstalls element in an unattend.xml file and pass that through to sysprep.

I created an unattend.xml file and placed it in my MDT Litetouch deployment share under the Tools directory.

This particular unattend.xml file is crafted to work for both x86 and x64 platforms.

<?xml version="1.0" encoding="utf-8"?>
<unattend
  xmlns="urn:schemas-microsoft-com:unattend"
  xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <settings pass="generalize">
  <component
    name="Microsoft-Windows-PnpSysprep"
    processorArchitecture="amd64"
    publicKeyToken="31bf3856ad364e35"
    language="neutral"
    versionScope="nonSxS">
   <PersistAllDeviceInstalls>true</PersistAllDeviceInstalls>
  </component>
  <component
    name="Microsoft-Windows-PnpSysprep"
    processorArchitecture="x86"
    publicKeyToken="31bf3856ad364e35"
    language="neutral"
    versionScope="nonSxS">
   <PersistAllDeviceInstalls>true</PersistAllDeviceInstalls>
  </component>
 </settings>
</unattend>

Within MDT LiteTouch I then can then set my CustomSettings.ini file to:

[default]
OSDAnswerFilePath=%deployroot%\tools\HyperV_Preserve.xml

Testing

After building out some of my virtual machines, I decided to run some performance tests against the images that got the PersistAllDeviceInstalls, and those that did not.

I have a script that will convert a *.wim to a *.vhdx file, and inject a custom unattend.xml file. Import the *.vhdx file into a virtual machine and start up.

For the image that was given PersistAllDeviceInstalls, it took 1 minute 20 seconds from the start of the virtual machine to the logon prompt.

For the normal image without PersistAllDeviceInstalls, it took about 3 minutes from the start of the virtual machine to the logon prompt.

That cut our install time down by almost HALF! Pretty cool!

-k

Next up, playing around with the VDI optimization scripts from Jeff and Carl

http://blogs.technet.com/b/jeff_stokes/archive/2013/04/09/hot-off-the-presses-get-it-now-the-windows-8-vdi-optimization-script-courtesy-of-pfe.aspx

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s