Back To Basics: Deploy a VM from a Template (Windows) (Part 2)
It’s possible to deploy a VM from template using the New Virtual Machine Wizard, and its also possible to right-click the template and also Deploy VM from this template, Convert to Virtual Machine and Clone To Template
1. Open the New Virtual Machine wizard, and select Deploy from template
2. Next explore the inventory to select the template you wish to wish to use as the source. In this case we will use all of the options available to show the full functionality.
3. Next, set a name for the new VM, and a location in the vCenter Inventory
4. Select a Host, Cluster or Resource Pool to that will provide resources to the VM
5. Next select a datastore to hold the VM. The option for the disks to be use the Same format as source – will ensure if the source is using thickly provisioned disks, the cloned VM will as well – and if the source is thinly provisioned the virtual disks of the clone VM will be same as well. The pull-down list does allow the administrator over-ride this – and change the target cloned disk format if necessary.
Guest Customization from a Template
Whilst vSphere supports one of the widest range of guest operating systems available – that does not mean all OSes are supported for Guest Customization. This is particularly significant when it comes to Linux distributions where the sheer vast array of Linux distributions, and the rapidity of their release restricts the Guest Customization options. However, there cases where a Windows OS is supported by vSphere, but not for Guest Customization for instance Windows 2000 is no longer supported for guest customization. In terms of Linux, CentOS is not supported for Guest Customization at all (although it is a support guest operating system), and as such if a template is made from it and deployed as a VM the administrator will receive this warning:
This is a recent list of Guest Operating Systems and their status in terms of Guest Customization Support:
- Windows Server 2012R2 – Yes
- Windows Server 2012 -Yes
- Windows Server 2008R2 – Yes
- Windows Server 2008 Yes –
- Windows Server 2003R2 – Yes
- Windows Server 2003 – Yes
- Windows Server 2000 – No
WARNING: In order for some Windows OS to join the domain during using Sysprep a DHCP IP address must assigned during the customization process. This is despite the fact you may assigned a static IP address with the Guest Customization Specification – many Sysprep clients default to DHCP on the first boot. Without a valid IP address the VM will not join the domain.
6. At this stage the administrator will see the Guest Customization window. In a clean installation this will be blank. The screen grab below shows an environment where some guest customizations specs have all already be saved. Guest Customizations hold the typical question need to automate the generalization of the guest operating system. The question asked can be saved to guest customization spec settings which saves lots of time – by not having to set variable such as Computer Name, Windows License, Administrator Password, Time Zone, Run Once, Networking and Domain membership. The guest customization wizard differs from Windows to Linux so its look and feel alters depends on the OSes contained in the template.
The page icon with a green plus, can be used to add a new customization spec
Note: When this icon is clicked the Deploy from template wizard is minimised to Work in progress pane, and the New VM Guest Customization Spec window is loaded
7. The first part of the Guest Customization Wizard requires a friendly name to inputed, together with an optional description.
Note: Some Windows Administrators have spent time developing sysprep.inf files, and these can be re-use and uploaded into the Guest Customization Wizard if you prefer
8. Set Registration Information allows the administrator to configure the user name and organization
9. Next we can set the Computer Name. It is possible to input manually, and have that name appended with unique characters. Alternatively, we can make sysprep make set the computer name to be the same as name specified in the Deploy from template wizard – alternatively we can pause the cloning process to ask the user to set the computer name. Finally, custom applications can be registered with vCenter to set the name, and hold this as record in a database.
10. For operating systems that require it you can configure Enter Windows License key. This can be useful if their is KMS service available and the organisation is using Windows Datacenter licensing which allows unlimited copies to run. Not all Windows editions require a license key to function – for instance Windows 2008 R2 does not require a license to be installed
11. The next part of the wizard allows you to set the Local Administrator Password. The Automatically logon as Administrator option automates the Ctrl+Alt+Del login process in Windows to allow for further post-scripting and tooling of Windows. This can be used in conjunction with the Run Once options to call those scripts.
12. Next configure the Time Zone for the VM
13. The Run Once option allows the administrator to call additional post configuration scripts
14. The Configure Network, allows the administrator set the VM to use either a DHCP address or configured with a Manual IP Address. If a manual IP address is selected again the administrator can opt to set a Static IP Address or stall the customization process to allow an operate to set it manually.
Once selected, the “pencil icon” can be used to the edit the IP configuration – with the DNS options allowing the administrator to set the DNS Suffix, and WIN option to configure the Primary/Secondary WINS server(s) if present.
15. Next Set Workgroup or Domain, allows the administrator to join the VM to a Microsoft Active Directory Domain. Starting from Windows 7/2008 many people in the community report that the most reliable method of doing this is to use domain.com notation, rather than the more classic DOMAIN\Username format.
16. Set Operating System Options – allows the administrator to force sysprep to regenerate the Security Identify or SID that is just in Windows to unique identify a node on the network.
17. Once the Guest Customization Wizard has completed the wizard will be dismissed and the Deploy VM from a Template wizard will appear allowing the administrator to select the Guest Customization Spec from the list.
Completing Deploy From Template
18. Once the Guest Customization has been selected, the Deploy From Template will return. If selected the administrator will be able adjust the VM settings – such as adding more vCPUs, Memory, and patching the VM to the correct network.
Once the VM is powered on Windows will trigger the Guest Customization process. In tests the complete sysprep process took around 6mins to complete in Windows 2012 R2. This involves three reboots – Windows boots for the first time, and then reboots – and then it reboots a second time. You can tell whether Guest Customization/Sysprep has completed as Windows 2012 R2 will not initially show the right time zone:
Note: Before Guest Customization Time Zone is Pacific Time
At the second boot you should see Windows splash “VMware image customization is in progress…”
The Administrator should also see Windows splash “Getting Devices Ready” and “Getting Ready”. At this stage the VM is joined to the domain, and Windows is rebooted again. It’s at this stage that the VM is ready for use.
Note: After Guest Customization Time Zone is GMT