Because organizations are increasingly using at least some virtual machines, it’s useful to be able to detect during an OS deployment if a task sequence is running on a physical machine or a virtual machine.  It’s also helpful to know if the physical machine is capable of being a virtualization host.  That’s where these enhancements to the MDT 2010 gathering process (ZTIGather.wsf) come from.  We now gather these additional details:

IsHypervisorRunning:  This variable is set to “True” if the processor reports that a hypervisor (any hypervisor) is currently running.  You can use this to detect the presence of a hypervisor-based virtualization solution (e.g. Hyper-V).

SupportsVT:  This variable is set to “True” if the processor reports that hardware-assisted virtualization is enabled.  (This could also be useful on laptops and desktops, as this is required for the new Virtual PC used as part of the Windows 7 XP Mode software.)  Note that SupportsVT will be false when running inside of a VM, as the VM hides the actual hardware support for this.

SupportsNX:  This variable is set to “True” if the processor reports that “NX” (no-execute) support is enabled.  This is another requirement for Hyper-V and other virtualization solutions.

Supports64Bit:  This variable is set to “True” if the processor reports that it supports 64-bit processing (as most do these days).  (Technically, this was already in MDT 2008, although through a different variable, CapableArchitecture.)

SupportsHyperVRole:  This variable is set to “True” if SupportsVT, SupportsNX, and Supports64Bit are all true.  Those are the main requirements for Hyper-V.

IsVM:  This variable will be set to true if we can detect that we are running in a virtual machine.  (While we can easily figure that out for Hyper-V, Virtual Server, Virtual PC, and VMware, we might not accurately figure this out for other virtualization solutions.)

VMPlatform:  This variable will be set to a value that tells you what virtualization platform we detected.  Values that are possible:

Hyper-V Beta or RC0
Hyper-V
VS2005R2SP1 or VPC2007
VS2005R2
VS2005 or VPC2004
VMware
VirtualBox

I make use of these variables inside of a task sequence to automate the installation of the needed Hyper-V integration components.  Here’s the process I go through for Lite Touch:

  1. Mount the “vmguest.iso” from Hyper-V (it contains the integration components).
  2. Create an application in Deployment Workbench, specifying “D:\Support\x86” as the path for the source files (assuming you mounted the ISO to D:).  Give it a name of something like “Hyper-V Integration Components x86”.  Specify an installation command line of “setup.exe /quiet /norestart”.  Check the “Reboot the computer after installing this application” checkbox.
  3. Add this application to your task sequence.
  4. Add a condition to the task sequence step for that application that specifies “VMPlatform equals Hyper-V”.

Repeat steps 1-4 for the amd64 platform (using “D:\Support\amd64” for the source).  The steps required for ConfigMgr would be slightly different (creating packages instead of applications), but the idea is the same.

You could also use this to automatically install the Hyper-V role on any machine with SupportsHyperVRole=True.  Just set up an “Install OS Roles” step with the “SupportsHyperVRole=True” condition.

All of these variables are available for both Lite Touch and ConfigMgr deployments.