One of the powerful features and functionality that virtualization provides to administrators is the ability to move quickly with provisioning resources. Today’s software driven approach to operating enterprise datacenters means that administrators can deploy infrastructure much more rapidly and with precision and control that simply cannot be achieved with “sneaker net” operating procedures.
One of the monotonous, time-consuming, and basic tasks that Hyper-V administrators find themselves performing, even daily or many times a day in some environments is creating virtual machines. Aside from container provisioning, standing up virtual machines is the most common resource found in today’s modern datacenters, driven by virtualization.
In the world of Hyper-V, how can Hyper-V administrators make use of the tools available to use the software-driven approach mentioned above to execute the provisioning of virtual machines more quickly?
Let’s take a look at Quick Virtual Machine Deployment with Hyper-V VM Templates and see how these are created and utilized.
What are Hyper-V Virtual Machine Templates?
First off, what is a virtual machine template?
When you think about the word template, you may well think about a “pattern” of sorts that allows you to reproduce or create something quickly and easily in the shape or form that you want it created. In a software sense when thinking about Hyper-V virtual machines, VM templates allow quickly creating new virtual machines with a master pattern of sorts that includes the virtual hardware configuration along with CPU, memory, network, and even software configuration.
For the most part, it may only take a few seconds to spin up a new “shell” virtual machine that only has the virtual hardware configured. However, it can take hours to install the operating system, install and configure all needed software required by your organization and also install any needed Windows Updates. By utilizing Hyper-V virtual machine templates, you can create a customized virtual machine containing everything required by your organization and use the template to provision new virtual machines. This way, you do not have to recreate the time and effort required to install all needed software on subsequent new virtual machines.
Let’s take a look at a couple of ways in Hyper-V that Hyper-V administrators can make use of virtual machine templates to provision new VMs. These include:
- Basic Hyper-V Virtual Machine Templates
- System Center Virtual Machine Manager Templates
The basic Hyper-V virtual machine template does not require any additional software or licensing and involves creating a virtual machine, running the necessary steps to generalize the virtual machine and then copying the VHD or VHDX to a location that can be used for deploying additional virtual machines.
System Center Virtual Machine Manager is the “pay for” enterprise management software that organizations can utilize with Hyper-V to have centralized management and other unlocked features that make managing and configuring Hyper-V much easier.
Basic Hyper-V Virtual Machine Templates
With basic Hyper-V virtual machine templates, you can manually create a virtual machine template in just a few quick and easy steps. In fact, manually creating a Hyper-V VM template is simply performing most of the steps that are accomplished with System Center Virtual Machine Manager when you create a template there.
The steps involved include:
- Create a new Hyper-V virtual machine
- Configure the VM and load the needed software
- Run Sysprep on the virtual machine to generalize the Windows installation
- Copy the VHD or VHDX to a “Library” type location or share
- Identify the template by a name that is intuitive
- To deploy from the template, copy the template VHD or VHDX to a new location for a new virtual machine you want to deploy
- Create a new virtual machine and point to the copied template hard disk file
- Boot the new virtual machine and follow the mini setup wizard for the Sysprep out-of-box experience
- After some basic configuration, the new virtual machine, representing hours of work initially on the template master, is now ready to use after perhaps only a few minutes!
The above represents the manual way to provision template VHD(X) hard disks in Hyper-V and use these disks as copy masters so that new hard disks copied from the virtual disk template files will contain the same software and operating system configuration as the master, including Windows Updates, etc. This can save a tremendous amount of time and administrative effort to deploy virtual machines to production.
Let’s now take a look at a more streamlined way to accomplish the above tasks with System Center Virtual Machine Manager.
System Center Virtual Machine Manager Templates
The System Center software package is a monolithic management software from Microsoft that can do just about anything. In the scope of virtualization however, System Center Virtual Machine Manager allows Hyper-V administrators to have a centralized management plane for performing configuration and management of Hyper-V. One of the things that can be done in a more “wizardized”, automated way is creating Hyper-V virtual machine templates.
To create a new virtual machine template in SCVMM, click Library >> Templates >> right click VM Templates >> Create VM Template.
The Create VM Template Wizard begins. You can use an existing VM template or a virtual hard disk stored in the library, or you can manually select your own VHD(X) file to use.
The Select VM Template Source launches and allows picking from “in the box” templates already configured (no operating system).
Configure the Identity for the new template. Typically, you would want to name the template something intuitive. This could be the loaded operating system or any other description that would be helpful.
Next, you configure the hardware. This would include the processor layout and configuration, memory, virtual media, etc. This saves you from having to configure specific hardware settings each time you deploy a virtual machine.
The next step involves configuring the operating system. Here you are not installing the OS, but rather telling the template the variant of operating system the template will contain (Windows 10, Windows 8.1, etc).
The next two options relate to templates that have the operating system set for a Windows Server operating system – Application Configuration, and SQL Configuration. In the example configuration, Windows 10 was chosen, so these screens will not be relevant to the operating system install.
At this point, the SCVMM Hyper-V template is ready to be created with the configured parameters. Select the Create button and the template should be successfully created.
After the template is created, you can click the Templates >> VM Templates >> click the new template created >> Create Virtual Machine to deploy a new virtual machine from the newly created template.
With System Center Virtual Machine Manager, creating a new virtual machine template is extremely easy. It makes the manual processes required without SCVMM irrelevant and fully automates the process.
Automating infrastructure processes is a powerful way that Hyper-V administrators can become more agile, quick, and efficient in provisioning virtual resources. One of the more time and effort intensive operations in the day to day tasks of a Hyper-V administrator is creating a new virtual machine or many virtual machines.
Creating a new virtual machine involves more than simply creating the “shell” virtual machine. It includes the time involved with loading the operating system, loading custom software, and configuring the virtual machine for the particular organization’s environment.
By creating Hyper-V virtual machine templates, either manually, or using SCVMM, Hyper-V administrators can deploy one or many virtual machines in a fraction of the time it would take to manually install and configure individual virtual machines from scratch. Leveraging these capabilities, features, and management software such as SCVMM utilized in conjunction with PowerShell, Hyper-V administrators can get much closer to operating infrastructure as code and becoming much more agile in their operations.Like what you read? Rate us