AVD Hybrid on VMware vSphere: Create a VM template

Note

The feature is in Public Preview.

This article describes how to create a VM template in VMware vCenter Server for use with vSphere host pools in Nerdio Manager. The template is created and managed directly in vCenter.

Overview

How VM templates are used in vSphere host pools

When you add a session host to a vSphere host pool in Nerdio Manager, a VM template stored in vCenter Server serves as the source image for session host provisioning. Nerdio Manager clones the template into the folder and resource pool you select, applies the CPU and memory you specify, and uses vSphere guest customization to prepare Windows. During guest customization, vSphere runs Sysprep on the new VM and applies an unattend.xml that sets the computer name, joins the VM to your Active Directory domain, and runs the Azure Arc onboarding script.

Because vSphere guest customization generalizes each new session host, the template does not need to be generalized with Sysprep before you use it. The template must contain VMware Tools and all required software, and Windows must be prepared as described in this article.

Create a VM template in vCenter

Use this procedure to build your VM template in vCenter Server with the vSphere Client.

Prerequisites

System and environment requirements

The following are required before carrying out this procedure:

  • OS image: An ISO of a supported operating system (Windows 11 Enterprise single-session, or Windows Server), downloaded manually.

  • VMware Tools: Included with ESXi. You install it inside the VM during this procedure. vSphere guest customization requires the latest version of VMware Tools on the template.

  • vCenter access: A vSphere Client account that can create VMs, upload files to a datastore, and convert VMs to templates in the target datacenter.

  • Key provider (Windows 11 only): Windows 11 requires TPM 2.0. To add a virtual TPM (vTPM) to the VM, a key provider must be configured in vCenter Server, for example the vSphere Native Key Provider.

Warning

  • Install the guest operating system on a disk attached as SCSI node 0:0. vSphere guest customization fails if the OS disk is attached to a different node or a different controller type.

  • Give the VM exactly one network adapter. Nerdio Manager configures one network adapter during guest customization, and customization fails if the template has more than one.

  • Do not enable BitLocker on the source VM. Guest customization runs Sysprep on each session host, and Sysprep cannot generalize a volume protected by BitLocker.

Procedure

Sign in to vCenter Server

Sign in to vCenter Server with the vSphere Client.

Upload the ISO

If the OS ISO is not already available on a datastore, upload it as follows:

  1. Navigate to Storage and select the datastore you want to use.

  2. Select the Files area.

  3. Select Upload Files and upload your OS ISO.

Create a VM

  1. Navigate to VMs and Templates, right-select the datacenter or folder where the template should be stored, and select New Virtual Machine.

  2. Select Create a new virtual machine, then follow the wizard:

    • Select a name and folder: Enter a name for the VM and select a folder in the datacenter that your vSphere host pools use.

    • Select a compute resource: Select the cluster, host, or resource pool.

    • Select storage: Select a datastore for the template.

    • Select a guest OS: Select Windows and the matching version, for example Microsoft Windows 11 (64-bit) or Microsoft Windows Server 2022 (64-bit).

  3. In Customize hardware, configure the desired hardware (CPU, memory, etc.) and the following settings:

    • Hard disk: Set the size you want for the session host OS disk. Make sure the disk is attached to the SCSI controller at SCSI(0:0).

    • SCSI controller: LSI Logic SAS or VMware Paravirtual.

    • Network adapter: Connect it to a port group. VMXNET3 is recommended.

    • CD/DVD drive: Select Datastore ISO File, browse to your OS ISO, and select Connect At Power On.

    • Trusted Platform Module (Windows 11 only): Select Add New Device > Trusted Platform Module.

  4. For Windows 11, in the VM Options area, make sure Boot Options > Firmware is set to EFI and Secure Boot is enabled.

  5. Select Finish.

  6. Power on the VM and connect to it using the web console or VMware Remote Console.

Install Windows, VMware Tools, and software

  1. Install Windows from the ISO.

  2. If you selected the VMware Paravirtual SCSI controller and Windows Setup does not detect the disk, load the PVSCSI driver from the VMware Tools ISO during setup.

  3. Install VMware Tools: right-select the VM in the vSphere Client and select Guest OS > Install VMware Tools, then run the installer inside the VM and restart when prompted.

  4. Install any additional required software.

  5. Verify all drivers are working correctly via Device Manager. There should be no unknown or error devices.

Note

Do not join the VM to the domain, and do not install the Azure Virtual Desktop agents or the Azure Connected Machine agent. Nerdio Manager joins each session host to the domain, onboards it to Azure Arc, and installs the Azure Virtual Desktop agents during provisioning.

Prepare Windows for provisioning

Make sure all of the following are in place before you create the template:

Requirement

What to do

Windows is fully updated

Install the latest approved Windows updates and security patches, then complete any required restart. No Windows Update installation or restart can be pending.

BitLocker is off

Disable BitLocker on all volumes, including the operating system volume.

Remote Desktop is on

Set the registry value HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\fDenyTSConnections to 0.

Automatic sleep is off

Run the commands below in an elevated PowerShell session. A timeout of 0 disables sleep, so the VM can't go to sleep during provisioning.

To turn on Remote Desktop, run:

Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' -Name fDenyTSConnections -Value 0

To turn off automatic sleep, run:

powercfg /change standby-timeout-ac 0
powercfg /change standby-timeout-dc 0

Shut down the VM

  1. Shut down Windows from inside the VM, or right-select the VM and select Power > Shut Down Guest OS.

  2. Optionally, right-select the VM, select Edit Settings, and disconnect the OS ISO from the CD/DVD drive.

Warning

Do not generalize the VM with Sysprep before you create the template. vSphere guest customization runs Sysprep on every session host that Nerdio Manager creates. A template that was already generalized can cause guest customization to fail.

Create the VM template

  1. In the vSphere Client, navigate to VMs and Templates and locate the VM you wish to work with.

  2. Right-select the VM and select one of the following:

    • Template > Convert to Template: Converts the VM itself into a template.

    • Clone > Clone to Template: Creates a template from a copy of the VM and keeps the original VM.

  3. Follow the prompts. For Clone to Template, enter a template name and select a folder in the same datacenter.

  4. Confirm to create the template.

Note

When you add a session host, Nerdio Manager lists the VM templates in the datacenter you select. Store the template in the same datacenter as the folder and resource pool your session hosts use.

Clean up

If you used Clone to Template, the source VM can be deleted once the VM template is successfully created. If you used Convert to Template, there is no source VM to clean up.

To update the template later, right-select it and select Convert to Virtual Machine, power it on, make your changes, complete the steps in Prepare Windows for provisioning, shut it down, and convert it back to a template. Session hosts you add afterward use the updated template. Existing session hosts are not changed.

Was this article helpful?

0 out of 0 found this helpful
Have more questions? Submit a request

Comments (0 comments)

Article is closed for comments.