Setting up TSplus Remote Access on cloned virtual machines using sysprep image

Requirements

When working with cloned virtual machines, it is important to modify the computer name and disk volume ID to ensure a unique TSplus Remote Access installation and avoid licensing issues.

Computer name considerations

The computer name is stored in the Windows registry inside the image itself. If modified before applying the image, it will be overwritten by Sysprep when Windows boots. However, you can predefine a name in an Unattended.xml Answer file. See Microsoft Documentation for more details.

To set the computer name, add the following section inside Microsoft-Windows-Shell-Setup:

<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ComputerName>%COMPUTERNAME%</ComputerName> </component>

Volume ID considerations

The volume ID is associated with the disk partition, not the OS image. It can be changed before applying the image, and it will persist. Use volumeid.exe from Sysinternals, available at Microsoft Sysinternals, before Windows boots.

Deployment steps

When deploying a new virtual machine from a sysprepped image, Windows will enter the Out-Of-Box Experience (OOBE) on first boot, prompting for configuration settings.

  1. Boot to WinPE – Prepare the system without booting into Windows.
  2. Set the Volume ID – Change it before applying the image so it persists.
  3. Deploy the sysprepped image – Use DISM to apply the image to C:.
  4. Set the computer name offline – Edit the registry inside the mounted image.
  5. Copy an Unattended.xml file – Automate OOBE configuration. This file can be dynamically modified before deployment using a script.
  6. Create a first-boot script – Ensure final configurations with only one reboot.
  7. Reboot into Windows – Windows finalizes itself using the specified configurations.
  8. Reset Remote Access licensing – Run the following command:

AdminTool.exe /license /reset

This resets licensing and applies a new license.

Deployment script

Please find below the related WinPE deployment script.

<# Define variables #>
$ImagePath = "D:\Images\Windows.wim"   # Path to your sysprepped image
$ApplyDrive = "C:"                     # Target drive for deployment
$ComputerName = "REMOTE ACCESS-SERVER-" + (Get-Random -Minimum 1000 -Maximum 9999)  # Generate a random name (naive implementation)
$VolumeID = "1234-ABCD"                 # Desired Volume Serial Number
$UnattendFile = "D:\Unattended.xml"     # Path to the unattended answer file

Write-Host "=== Windows Deployment Automation ==="

<# 1️. Set Volume ID before applying the image #>
Write-Host "Setting Volume ID..."
Start-Process -NoNewWindow -Wait -FilePath "volumeid.exe" -ArgumentList "$ApplyDrive $VolumeID"

<# 2️. Apply the Sysprepped Windows image #>
Write-Host "Applying Windows Image..."
dism /apply-image /imagefile:$ImagePath /index:1 /applydir:$ApplyDrive

<# 3️. Load Registry Offline to Set Computer Name #>
Write-Host "Modifying Registry to Set Computer Name..."
reg load HKLM\TempSys $ApplyDrive\Windows\System32\Config\SYSTEM
reg add "HKLM\TempSys\ControlSet001\Control\ComputerName\ComputerName" /v ComputerName /t REG_SZ /d "$ComputerName" /f
reg unload HKLM\TempSys

<# 4️. Ensure Unattended Setup is Used #>
Write-Host "Copying Unattended File..."
Copy-Item -Path $UnattendFile -Destination "$ApplyDrive\Windows\Panther\Unattended.xml" -Force

<# 5️. Set the First Boot Script for Final Configurations #>
Write-Host "Creating First Boot Script..."
$FirstBootScript = @"
Write-Host "Finalizing Configuration..."
Rename-Computer -NewName "$ComputerName" -Force
Restart-Computer -Force
"@
Set-Content -Path "$ApplyDrive\Windows\Setup\Scripts\SetupComplete.cmd" -Value $FirstBootScript -Encoding ASCII

Write-Host "Deployment Complete! Rebooting into Windows..."
Write-Host "==============================================="
Write-Host "  Computer Name: $ComputerName"
Write-Host "  Volume ID: $VolumeID"
Write-Host "  Image Applied to: $ApplyDrive"
Write-Host "==============================================="

<# Reboot into Windows #>
wpeutil reboot

Licensing activation

After deployment, activating a license will generate a new Computer ID for the virtual machine. This Computer ID is created by the licensing portal when a machine requests a trial or license activation. For cloned virtual machines, license activation is mandatory. Use either an activation key or a volume license key. Offline setups are not permitted due to security concerns. For detailed activation steps, refer to TSplus Commands List.

Conclusion

This guide outlines key considerations for deploying cloned virtual machines with TSplus Remote Access. It provides essential steps to configure and license the system correctly and must be adapted to your needs and requirements.