Clonage de serveurs à l'aide de sysprep
Requisitos
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.
Considérations sur le nom de l'ordinateur
El nombre del equipo se almacena en el registro de Windows dentro de la imagen misma. Si se modifica antes de aplicar la imagen, será sobrescrito por Sysprep cuando Windows se inicie. Sin embargo, puedes predefinir un nombre en un
Unattended.xml
Antwortdatei. Siehe
Dokumentacja Microsoftu
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>
Considérations sur l'ID de volume
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
de Sysinternals, disponible à
Microsoft Sysinternals
, antes de que Windows se inicie.
Étapes de déploiement
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.
Recommended steps for deployment:
- Boot to WinPE – Bereiten Sie das System vor, ohne in Windows zu booten.
- Set the Volume ID – Modifiez-le avant d'appliquer l'image afin qu'il persiste.
-
Deploy the sysprepped image
– Utiliser DISM pour appliquer l'image à
C:
. - Definir el nombre de la computadora sin conexión – Editar el registro dentro de la imagen montada.
-
Copiar un
Unattended.xml
date – Automatiser la configuration OOBE. Ce fichier peut être modifié dynamiquement avant le déploiement à l'aide d'un script. - Create a first-boot script – Assurez-vous des configurations finales avec un seul redémarrage.
- Reiniciar en Windows – Windows se finaliza utilizando las configuraciones especificadas.
- Resetting Remote Access licensing – Ejecuta el siguiente comando:
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
Activation de la licence
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 Befehlsliste .
Conclusión
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.