Username or Email Address
Most of the companies have to install guide to deploy servers with manual or automatic steps. These guides exist to get a consistent server installation across the organization. Thanks to a consistent environment, the management of the infrastructure is easier and the outages are less common.
Because a virtual machine is basically software, it’s easy to clone and redeploy. We can also create a template from a virtual machine and create new VMs from this template. In this way, we can customize the “initial VM” such as update the OS, copy scripts or set the system, make a template and deploy new VMs from this template. All new VMs will get the OS customization. All that remains to be done is to set the specific parameters of the OS such as IP address, computer name or specific scripts to run. So you can automate the VM deployment regarding your server specifications.
In this topic, we will see how to create a template from a VMware VM and how to deploy new from this template.
The screenshots have been taken from the following environment:
The VM I’ll deploy is a Windows Server 2016 Standard Core Edition. You can download an evaluation ISO from here.
First of all, I create a new VM in vCenter Server. Then I choose Create a new virtual machine.
Next, specify the name of the virtual machine and choose a VM folder. I have created a folder called template where all my templates belong to.
In the next screen, choose the host or the cluster that will run the virtual machine.
Then choose the datastore where you want to store the virtual machine. In my example, I choose the vSAN datastore.
Next, specify the compatibility of the virtual machine. I choose ESXi 6.5 because all my nodes run with this version. If you have older ESXi in your datacenter, choose an older compatibility version. Don’t forget that the future VMs will be deployed with the same settings than this one.
Then choose the operating system you want to deploy. For this example, I deploy Windows Server 2016.
Next, configure the hardware as you wish. For example, I prepare the VM in DEV network and I configure CPU and Memory Hot Add. I verify also that the hard disk is deployed in thin provisioning. To finish I mount the Windows Server 2016 ISO.
In VM Options, I choose to lock the operating system when the last user is disconnected from the remote console and I set the boot option to UEFI (and secure boot).
To create the VM, just click on the finish in the last screen.
Once the VM is created, just power on the VM and install the Windows Server you want. From my side, I have deployed Windows Serer 2016 Standard core edition. Once the OS is deployed, you can customize it. To make the first configuration I use sconfig:
Thanks to this tool, you just have to type the number and make your configuration. You can, for example, set the Remote Desktop configuration or update the operating system.
Specify settings such as time zone, computer name, domain and so on will be removed when VMware will apply the customization. So, don’t apply settings on specialized configuration. Don’t forget also to install VMware tools.
Once the OS is upgraded, I can create folders, copy PowerShell scripts, binaries or/and configuration files. When you have finished customizing your operating system, just power off the server. Instead of sysprep the “initial VM” like with Hyper-V, VMware runs the customization after the new VM are deployed from the template. So, you can convert the VM into the template and revert back to VM to apply for example new patches.
Once you have finished your OS customization and the VM is powered off, you can convert the VM to a template. Before converting the VM to a template, I change the network to PROD:
Next, I convert the VM to a VM template by right clicking on the VM and choosing Template | convert to Template.
To create a new VM from the template, right-click on the template and choose New VM from this template.
Specify the VM name and choose a folder where the VM belongs to.
Next, choose a host or a cluster where the VM will be hosted.
Then choose a datastore. From my side, I choose the vSAN datastore.
In the next screen, I choose to customize the operating system and to power on the virtual machine after the creation.
Next, choose to create a customize guest OS specification.
First, give a customization spec name and a description. You can also choose if you want to use a sysprep answer file. I have written this topic about how to specialize a Windows Server guest OS (Hyper-V) and it explains how to create an answer file. For this example, I don’t use the answer file.
Next, specify registration information and click on next.
In the next screen, I choose to use the virtual machine name for the OS computer name.
Next, specify a valid license key.
Then choose an administrator password and choose if you want to be logged automatically with the administrator account. It can be useful if you have scripts which require several reboots. However, be careful because the password will be written in clear in registry while the specified number of the reboot is not reached.
Next, choose the time zone you want.
If you have scripts to run at the first login, you can enter the commands here. For example, you may want to deploy antivirus, System Center agents or other products. So, by scripts, you can run these deployments.
Then you can configure the network adapter(s) configuration. If you want manually configure the network adapters, you can select Manually select custom settings and click on “the pen” symbol.
Choose if you want to DHCP or static IP address. You can also pick up an IP from a script or be prompted when the specification is used. I choose to set a static IP for this example.
You can also specify the DNS server and the DNS suffixes.
Once you have finished setting the network configuration, you can choose to join a domain. Specify the domain name and the user which will be used to join the domain.
The account chosen to join the domain must have permission on the default computer OU. The account must be allowed to create computer account object.
To avoid issues in Active Directory, you have to generate a new SID for your new Operating System.
To finish with the guest customization spec, review what you have set and if all is correct, click on finish.
In the VM creation wizard, select the new VM guest optimization Spec and click on next. Then review the settings and click on finish to deploy the new VM.
The VM will be automatically powered on. The OS is started but at this step, the customization is not applied. Wait a few minutes and the server should reboot automatically. Then this message will appear:
At this moment, the VM customization is applied and so the server is renamed, the IP configuration is applied and the server joins the domain.
Once the server is ready, you should have all information in vCenter like in the below screenshot.
At this step, your VM is ready.
You can convert a template to a virtual machine. To run this process, just right click on the template and choose Convert to Virtual Machine.
Review the settings and click on finish to convert the template to a VM.
When the process is finished, you have again a virtual machine instead of a template.
Sample rating item
Microsoft, Software by Romain Serre
[…] that my VM is running on Azure, I’ll join him to my […]
[…] restoring a VM from a replica, we’ll see this picture […]
[…] Find More on|Find More|Find More Infos here|Here you will find 26306 more Infos|Infos to that Topic: aclouda.com/blog/ms/deploy-a-vmware-vm-from-a-template/ […]
[…] Find More here|Find More|Read More Informations here|There you can find 76064 additional Informations|Infos on that Topic: aclouda.com/blog/ms/deploy-a-vmware-vm-from-a-template/ […]
[…] Find More on|Find More|Read More Infos here|Here you will find 80841 additional Infos|Informations on that Topic: aclouda.com/blog/ms/deploy-a-vmware-vm-from-a-template/ […]
You must be logged in to post a comment.