Windows 11 Client Template Preparation Script
#Requires -RunAsAdministrator
$ErrorActionPreference = "Continue"
Write-Host "Starting Windows 11 Template Preparation..." -ForegroundColor Green
# ============================================================
# 1. REMOTE DESKTOP (Manual)
# ============================================================
# Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name "fDenyTSConnections" -Value 0
# Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
# ============================================================
# ============================================================
netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv4-In)" new enable=yes profile=any
# ============================================================
# ============================================================
Set-TimeZone -Id "W. Europe Standard Time"
# ============================================================
# 4. LANGUAGE & REGIONAL SETTINGS
# ============================================================
Set-WinUILanguageOverride en-US
Set-WinSystemLocale -SystemLocale en-US
Set-WinUserLanguageList de-CH -Force
$1 = Get-WinUserLanguageList
$1.RemoveAll( { $args[0].LanguageTag -clike '' } )
Set-WinUserLanguageList $1 -Force
# ============================================================
# ============================================================
powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
powercfg /change monitor-timeout-ac 0
powercfg /change standby-timeout-ac 0
# ============================================================
# 6. SYSPREP COUNTER RESET
# ============================================================
Set-ItemProperty -Path "HKLM:\SYSTEM\Setup\Status\SysprepStatus" -Name "CleanupState" -Value 2
Set-ItemProperty -Path "HKLM:\SYSTEM\Setup\Status\SysprepStatus" -Name "GeneralizationState" -Value 7
# ============================================================
# ============================================================
Remove-Item -Path "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue
Write-Host "Preparation Complete! Run Sysprep via noVNC." -ForegroundColor Green