ltstudiooo - Fotolia
Use Sysprep to generalize Hyper-V VMs for rapid deployment
Microsoft's Sysprep tool enables rapid Hyper-V VM configuration and deployment through image generalization. Use commands to speed up configuration and disaster recovery.
If you want to reduce the time it takes to configure VMs and ready them for production, consider using Microsoft...
Continue Reading This Article
Enjoy this article as well as all of our content, including E-Guides, news, tips and more.
Sysprep to generalize Hyper-V VMs.
Microsoft offers the System Preparation Tool (Sysprep) to generalize physical machines and VMs. You might have used Sysprep to generalize a physical computer, but you can also use it to generalize a VM running on Hyper-V for rapid deployments.
A generalized image is useful in a number of ways. It takes less time to configure a VM and prepare it for production. In the event of a disaster, you can regain business continuity more quickly because it's faster to restore generalized VMs than non-generalized VMs running the same business applications.
In a development environment where developers don't have sufficient knowledge about VM OSes, you can generalize a VM and distribute it via System Center Virtual Machine Manager (SCVMM) or any other deployment methods.
To decide how many generalized images to create, consider the context and size of your system. For example, if you have multiple Windows OSes running in your environment, then you need at least one generalized image for each OS. You also need to consider the settings and applications you'll deploy on these OSes. One generalized image is necessary for similar sets of applications and settings.
Use Sysprep to generalize and create an image
The Sysprep tool that ships with Windows 8 and Windows Server 2012 comes with a new option called /mode:VM that you can use to generalize a VM.
The Sysprep tool can remove duplicate information from the OS and make it ready to use with any hardware.
Install the OS inside the VM and configure it how you want. You need to install an OS that the /mode:VM switch supports. The /mode:VM switch is only available on Windows 8, Windows 8.1, Windows 10, Windows Server 2012 and later server OSes.
If you need to automate general setup information, create an answer file and copy the answer file to %WinDir%\System32\Sysprep\Unattend.xml.
Execute the Sysprep command inside the VM with the /mode:VM switch shown below.
%WinDir%\System32\Sysprep\Sysprep.exe /OOBE /Generalize /Shutdown /Mode:VM
Once the command is complete, the OS will generalize and shut down. Next, copy the VHD or VHDX file to the SCVMM library server for rapid deployment or attach it to a new VM.
The above commands used Sysprep to generalize with the /mode:VM switch. You can only use the /mode:VM switch for a VM, not a physical machine.
The /mode:VM switch serves two purposes. It only allows the use of a generalized VM within this virtualization environment. It also removes unneeded drivers and support files to reduce the overall size of the image, which helps the OS boot faster.
There are some limitations when using the /mode:VM switch. When you use /mode:VM for a VM, you can only use the VHD and VHDX files on the same VM or hypervisor. The /mode:VM switch is also only available through the command line.
You can use Sysprep to generalize a VM for use within a Hyper-V environment by using the /mode:VM switch with the Sysprep tool. The /mode:VM switch is available on Windows 8, Windows Server 2012 and later OSes. While there are some limitations to the /mode:VM switch, it can successfully restrict the use of VHD and VHDX files to the same hypervisor or a hypervisor with the same hardware profile.