XP11: single net40 binary runs on XP SP3 through Windows 11

Merge TeslaLauncherService (Session 0) + TeslaLauncherAgent (tray) into one
userland TeslaLauncher.exe. The split existed only to work around Vista+
Session 0 isolation; running everything in the auto-logged-in admin session
needs no service, no named pipe, and no flat<->wire conversion layer. The
original Elsewhen software was likewise a single binary.

net40 is the newest framework XP SP3 can install, and net40 assemblies load
in-place on the 4.8 runtime in Win10/11 -- one exe covers both.

- Contract: multi-target net48;net40. The net40 leg of PodRpcProtocol uses
  Newtonsoft.Json (STJ has no net40 target); JSON is shape-identical on the
  wire, and the request reader keeps date strings raw so Ping echoes
  byte-identically. Console keeps the untouched net48/STJ leg.
- MiniZip.cs: central-directory ZIP extractor (stored/deflate/ZIP64) since
  net40 has no ZipFile; zip-slip guarded.
- SecureConfig: RSACryptoServiceProvider instead of RSA.Create (net46+),
  no leaveOpen BinaryWriter/Reader, struct instead of ValueTuple, and no
  SetCompatibleTextRenderingDefault on the passcode thread (the merged app
  already has a form). netsh "interface ip" syntax was already XP-correct.
- Volume: nircmd -> CoreAudio (Vista+) -> winmm waveOutSetVolume (XP).
- Paths: CommonApplicationData resolved per-OS (XP has no C:\ProgramData);
  launcher log moved next to the key/config in the data dir.
- install.bat: dual-OS (cacls/icacls, netsh firewall/advfirewall, dism and
  UAC/notification steps skipped on XP, .NET 4.0 redist check, XP DHCP reset
  via netsh); no service registration -- HKLM Run key + auto-login on both;
  RegisterApplicationRestart supplies crash-restart on Vista+.
- Bench switches: /skipconfig, /port:NNNN.

Verified: Console + diff suite (103 tests) still green on the net48 leg;
E2E smoke test drove the net40 launcher over real TCP with the Console's own
PodManagerConnection (STJ client vs Newtonsoft server) -- Ping echo, volume,
app registry, launch/kill/watch, InstallProduct zip transfer + extract, and
uninstall orphan cleanup: 17/17 pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-10 18:59:06 -05:00
co-authored by Claude Fable 5
parent 1d95a800fd
commit 8730b9b966
16 changed files with 2090 additions and 2548 deletions
+245 -242
View File
@@ -1,40 +1,53 @@
@echo off
:: =============================================================================
:: TeslaLauncher Modern Installation Script
:: TeslaLauncher Modern - Installation Script (XP11 single binary, dual-OS)
:: =============================================================================
:: Run as Administrator on each cockpit PC.
:: Run as Administrator on each cockpit PC. Works on Windows XP SP3 and on
:: Windows 10/11 - one binary, one installer, two OS code paths where the
:: tooling differs (cacls/icacls, netsh firewall/advfirewall, no dism on XP...).
:: Must be run from the TeslaLauncher\ folder produced by build.bat:
::
:: TeslaLauncher\
:: install.bat <- this file
:: Service\TeslaLauncherService.exe
:: Agent\TeslaLauncherAgent.exe
:: App\TeslaLauncher.exe (net40 single binary)
:: dx9201006\DXSETUP.exe (DirectX June 2010 redist)
:: openal\oalinst.exe (OpenAL redist)
:: UltraVNC\UltraVNC_x64_Setup.exe (UltraVNC server + UltraVNC.inf)
:: UltraVNC\UltraVNC_x64_Setup.exe (UltraVNC server, Win10/11)
:: UltraVNC\UltraVNC_x86_Setup.exe (optional: UltraVNC for XP)
:: dotnet40\dotNetFx40_Full_x86_x64.exe (optional: .NET 4.0 for XP)
:: =============================================================================
setlocal enabledelayedexpansion
echo ============================================================
echo Tesla Launcher v4.11.4.1 - Installation
echo Tesla Launcher v4.11.4.1 - Installation (single binary)
echo ============================================================
echo.
:: ── Paths ─────────────────────────────────────────────────────────────────────
:: -- OS detection --------------------------------------------------------------
:: NT 5.x = XP / Server 2003 era. Everything else is treated as modern Windows.
set ISXP=0
ver | findstr /r /c:"Version 5\." >nul && set ISXP=1
if "%ISXP%"=="1" (echo OS : Windows XP era ^(NT 5.x^)) else (echo OS : Windows Vista or later)
echo.
:: -- Paths ----------------------------------------------------------------------
set ROOT=%~dp0
set SERVICE_SRC=%ROOT%Service
set AGENT_SRC=%ROOT%Agent
set INSTALL_DIR=C:\Program Files\TeslaLauncher
set DATA_DIR=C:\ProgramData\TeslaLauncher
set SERVICE_EXE=%INSTALL_DIR%\TeslaLauncherService.exe
set AGENT_EXE=%INSTALL_DIR%\TeslaLauncherAgent.exe
set SERVICE_NAME=Tesla Application Launcher
set SERVICE_DISPLAY=Tesla Application Launcher
set APP_SRC=%ROOT%App
set INSTALL_DIR=%ProgramFiles%\TeslaLauncher
set LAUNCHER_EXE=%INSTALL_DIR%\TeslaLauncher.exe
set CONSOLE_PORT=53290
:: CommonApplicationData differs by OS. The launcher resolves it via
:: Environment.GetFolderPath; these must match what it computes.
if "%ISXP%"=="1" (
set DATA_DIR=%ALLUSERSPROFILE%\Application Data\TeslaLauncher
) else (
set DATA_DIR=%ALLUSERSPROFILE%\TeslaLauncher
)
:: Auto-login account for the cockpit (kiosk). Plain-text password in the
:: registry is by design here closed network, single-purpose PC.
:: registry is by design here - closed network, single-purpose PC.
set AUTOLOGIN_USER=Firestorm
set AUTOLOGIN_PASS=thor6
@@ -42,139 +55,161 @@ set AUTOLOGIN_PASS=thor6
:: the mw4files / c shares browse cleanly. Change once per site if needed.
set WORKGROUP=Tesla
:: ── Admin check ───────────────────────────────────────────────────────────────
:: -- Admin check -----------------------------------------------------------------
net session >nul 2>&1
if %errorlevel% neq 0 (
echo ERROR: This script must be run as Administrator.
pause & exit /b 1
)
:: ── Verify source files ───────────────────────────────────────────────────────
if not exist "%SERVICE_SRC%\TeslaLauncherService.exe" (
echo ERROR: TeslaLauncherService.exe not found in %SERVICE_SRC%
echo Run build.bat first, then run install.bat from the TeslaLauncher\ folder.
pause & exit /b 1
)
if not exist "%AGENT_SRC%\TeslaLauncherAgent.exe" (
echo ERROR: TeslaLauncherAgent.exe not found in %AGENT_SRC%
:: -- Verify source files ---------------------------------------------------------
if not exist "%APP_SRC%\TeslaLauncher.exe" (
echo ERROR: TeslaLauncher.exe not found in %APP_SRC%
echo Run build.bat first, then run install.bat from the TeslaLauncher\ folder.
pause & exit /b 1
)
:: ── Detect and clean up existing installation ─────────────────────────────────
set EXISTING=0
if exist "%SERVICE_EXE%" set EXISTING=1
if exist "%AGENT_EXE%" set EXISTING=1
if "%EXISTING%"=="1" (
echo Existing installation detected. Cleaning up...
echo.
:: Stop and kill the Agent process
taskkill /F /IM TeslaLauncherAgent.exe >nul 2>&1
echo Agent process stopped.
:: Stop and remove the service, wait for it to fully stop
sc stop "%SERVICE_NAME%" >nul 2>&1
sc stop "Tesla Application Launcher" >nul 2>&1
timeout /t 3 /nobreak >nul
sc delete "%SERVICE_NAME%" >nul 2>&1
sc delete "Tesla Application Launcher" >nul 2>&1
timeout /t 2 /nobreak >nul
echo Service stopped and removed.
:: Delete old executables, logs, and session key so SecureConfig re-runs
del /F /Q "%SERVICE_EXE%" >nul 2>&1
del /F /Q "%AGENT_EXE%" >nul 2>&1
del /F /Q "%INSTALL_DIR%\podconf.log" >nul 2>&1
del /F /Q "%DATA_DIR%\TeslaKeyStore.key" >nul 2>&1
del /F /Q "%DATA_DIR%\LaunchApps.xml" >nul 2>&1
del /F /Q "%DATA_DIR%\configuring.json" >nul 2>&1
echo Old executables, logs, session key, and app config deleted.
:: Reset all physical Ethernet adapters to DHCP so the SecureConfig
:: protocol triggers correctly on the next boot.
:: We must REMOVE the static IP address entry first, then enable DHCP.
:: Set-NetIPInterface -Dhcp Enabled alone only flips the DHCP flag but
:: leaves the static address in the registry, so IsMachineConfigured()
:: still sees a non-DHCP adapter on the next boot and skips SecureConfig.
echo Resetting network adapters to DHCP...
powershell -NoProfile -Command "Get-NetAdapter -Physical | Where-Object {$_.Status -eq 'Up'} | ForEach-Object { $n=$_.Name; Get-NetIPAddress -InterfaceAlias $n -AddressFamily IPv4 -EA 0 | Where-Object {$_.PrefixOrigin -ne 'WellKnown' -and $_.PrefixOrigin -ne 'Dhcp'} | Remove-NetIPAddress -Confirm:$false -EA 0; Set-NetIPInterface -InterfaceAlias $n -Dhcp Enabled -EA 0 }; Get-NetAdapter -Physical | Where-Object {$_.Status -eq 'Up'} | Set-DnsClientServerAddress -ResetServerAddresses" >nul 2>&1
echo Network adapters reset to DHCP.
echo.
:: -- .NET Framework 4.0 check (XP ships no .NET; Win10/11 has 4.8 built in) ------
reg query "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" /v Install >nul 2>&1
if not errorlevel 1 goto :dotnet_ok
reg query "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client" /v Install >nul 2>&1
if not errorlevel 1 goto :dotnet_ok
if exist "%ROOT%dotnet40\dotNetFx40_Full_x86_x64.exe" (
echo .NET Framework 4.0 not found - installing it now ^(takes a few minutes^)...
"%ROOT%dotnet40\dotNetFx40_Full_x86_x64.exe" /q /norestart
echo .NET Framework 4.0 installed.
) else (
:: No existing install — still remove any stale service registration
sc stop "%SERVICE_NAME%" >nul 2>&1
sc stop "Tesla Application Launcher" >nul 2>&1
sc delete "%SERVICE_NAME%" >nul 2>&1
sc delete "Tesla Application Launcher" >nul 2>&1
timeout /t 2 /nobreak >nul
echo ERROR: .NET Framework 4.0 is not installed and dotnet40\ redist is not
echo in this package. Install dotNetFx40_Full_x86_x64.exe first.
pause & exit /b 1
)
:dotnet_ok
:: ── STEP 1: Create directories ────────────────────────────────────────────────
echo [1/8] Creating directories...
:: -- Detect and clean up existing installation -----------------------------------
echo Cleaning up any existing installation...
:: Stop launcher / legacy agent processes
taskkill /F /IM TeslaLauncher.exe >nul 2>&1
taskkill /F /IM TeslaLauncherAgent.exe >nul 2>&1
:: Remove the legacy two-process service registration (pre-XP11 installs)
sc stop "Tesla Application Launcher" >nul 2>&1
ping -n 4 127.0.0.1 >nul
sc delete "Tesla Application Launcher" >nul 2>&1
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v TeslaLauncherAgent /f >nul 2>&1
:: Delete old executables, logs, and session key so SecureConfig re-runs
if exist "%LAUNCHER_EXE%" (
del /F /Q "%INSTALL_DIR%\*.exe" >nul 2>&1
del /F /Q "%INSTALL_DIR%\*.dll" >nul 2>&1
del /F /Q "%INSTALL_DIR%\podconf.log" >nul 2>&1
)
del /F /Q "%INSTALL_DIR%\TeslaLauncherService.exe" >nul 2>&1
del /F /Q "%INSTALL_DIR%\TeslaLauncherAgent.exe" >nul 2>&1
del /F /Q "%DATA_DIR%\TeslaKeyStore.key" >nul 2>&1
del /F /Q "%DATA_DIR%\LaunchApps.xml" >nul 2>&1
del /F /Q "%DATA_DIR%\configuring.json" >nul 2>&1
del /F /Q "%DATA_DIR%\podconf.log" >nul 2>&1
echo Old executables, logs, session key, and app config deleted.
:: Reset all Ethernet adapters to DHCP so the SecureConfig protocol triggers
:: on the next boot. The static address entry must be REMOVED, not just the
:: DHCP flag flipped, or IsMachineConfigured() still sees a static adapter.
echo Resetting network adapters to DHCP...
if "%ISXP%"=="1" (
rem XP: netsh "interface ip set address <name> dhcp" clears the static entry.
rem Enumerate interface names from "netsh interface show interface" (col 4+).
for /f "skip=3 tokens=4*" %%i in ('netsh interface show interface') do (
if "%%j"=="" (
netsh interface ip set address "%%i" dhcp >nul 2>&1
netsh interface ip set dns "%%i" dhcp >nul 2>&1
) else (
netsh interface ip set address "%%i %%j" dhcp >nul 2>&1
netsh interface ip set dns "%%i %%j" dhcp >nul 2>&1
)
)
) else (
powershell -NoProfile -Command "Get-NetAdapter -Physical | Where-Object {$_.Status -eq 'Up'} | ForEach-Object { $n=$_.Name; Get-NetIPAddress -InterfaceAlias $n -AddressFamily IPv4 -EA 0 | Where-Object {$_.PrefixOrigin -ne 'WellKnown' -and $_.PrefixOrigin -ne 'Dhcp'} | Remove-NetIPAddress -Confirm:$false -EA 0; Set-NetIPInterface -InterfaceAlias $n -Dhcp Enabled -EA 0 }; Get-NetAdapter -Physical | Where-Object {$_.Status -eq 'Up'} | Set-DnsClientServerAddress -ResetServerAddresses" >nul 2>&1
)
echo Network adapters reset to DHCP.
echo.
:: -- STEP 1: Create directories ---------------------------------------------------
echo [1/7] Creating directories...
if not exist "%INSTALL_DIR%" mkdir "%INSTALL_DIR%"
if not exist "%DATA_DIR%" mkdir "%DATA_DIR%"
if not exist "C:\Games" mkdir "C:\Games"
:: Grant all users modify access to the data and games directories so
:: the Service and Agent can write files (LaunchApps.xml, game installs).
icacls "%DATA_DIR%" /grant *S-1-5-32-545:(OI)(CI)M /T >nul 2>&1
icacls "C:\Games" /grant *S-1-5-32-545:(OI)(CI)M /T >nul 2>&1
:: Grant Users modify access to the data and games directories so the launcher
:: can write files (LaunchApps.xml, session key, game installs) from any account.
if "%ISXP%"=="1" (
cacls "%DATA_DIR%" /T /E /G Users:C >nul 2>&1
cacls "C:\Games" /T /E /G Users:C >nul 2>&1
) else (
icacls "%DATA_DIR%" /grant *S-1-5-32-545:(OI)(CI)M /T >nul 2>&1
icacls "C:\Games" /grant *S-1-5-32-545:(OI)(CI)M /T >nul 2>&1
)
echo %INSTALL_DIR%
echo %DATA_DIR% (Users: modify access)
echo C:\Games (Users: modify access)
:: ── STEP 2: Copy files ────────────────────────────────────────────────────────
echo [2/8] Copying files...
:: net48 framework-dependent build: each folder holds the exe + its dependency
:: DLLs + .config. Copy both folders into the install dir (shared DLLs overwrite
:: identically; the two .exe.config files coexist).
copy /Y "%SERVICE_SRC%\*.*" "%INSTALL_DIR%\" >nul
copy /Y "%AGENT_SRC%\*.*" "%INSTALL_DIR%\" >nul
:: -- STEP 2: Copy files ------------------------------------------------------------
echo [2/7] Copying files...
:: net40 framework-dependent build: the folder holds the exe + its dependency
:: DLLs (Newtonsoft.Json, TeslaConsoleLaunchLib) + .config.
copy /Y "%APP_SRC%\*.*" "%INSTALL_DIR%\" >nul
:: Install DirectX June 2010 runtime (required by games)
if exist "%ROOT%\dx9201006\DXSETUP.exe" (
:: Install DirectX June 2010 runtime (required by games; supports XP and Win10/11)
if exist "%ROOT%dx9201006\DXSETUP.exe" (
echo Installing DirectX runtime...
"%ROOT%\dx9201006\DXSETUP.exe" /silent
"%ROOT%dx9201006\DXSETUP.exe" /silent
echo DirectX installed.
)
:: Install OpenAL runtime (required by game audio)
if exist "%ROOT%\openal\oalinst.exe" (
if exist "%ROOT%openal\oalinst.exe" (
echo Installing OpenAL runtime...
"%ROOT%\openal\oalinst.exe" /s
"%ROOT%openal\oalinst.exe" /s
echo OpenAL installed.
)
:: Install UltraVNC server (remote diagnostics). The Inno installer lays down
:: the files and (via /loadinf) sets the install dir + VNC password; we then
:: register and start the service EXPLICITLY with winvnc.exe. Doing the service
:: step ourselves means a missing/incomplete "install service" task in the
:: answer file can't leave the pod with the files present but nothing listening.
set UVNC_SETUP=%ROOT%UltraVNC\UltraVNC_x64_Setup.exe
set UVNC_DIR=C:\Program Files\uvnc bvba\UltraVNC
if exist "%UVNC_SETUP%" (
:: Install UltraVNC server (remote diagnostics). x64 build for modern Windows;
:: XP uses the x86 build when the package carries one.
set UVNC_SETUP=
if "%ISXP%"=="1" (
if exist "%ROOT%UltraVNC\UltraVNC_x86_Setup.exe" set UVNC_SETUP=%ROOT%UltraVNC\UltraVNC_x86_Setup.exe
) else (
if exist "%ROOT%UltraVNC\UltraVNC_x64_Setup.exe" set UVNC_SETUP=%ROOT%UltraVNC\UltraVNC_x64_Setup.exe
)
if defined UVNC_SETUP (
echo Installing UltraVNC server...
start "" /wait "%UVNC_SETUP%" /verysilent /norestart /loadinf="%ROOT%UltraVNC\UltraVNC.inf"
)
) else (
if "%ISXP%"=="1" echo UltraVNC x86 setup not in package - skipped on XP.
)
:: Enable SMB1 client AND server (required by game networking). The pod both
:: reaches SMB1 shares (client) and hosts the mw4files / c shares below (server),
:: and Win10/11 ship both SMB1 sub-features off by default so enable all three
:: (umbrella + client + server); each child pulls in the umbrella via /All.
echo Enabling SMB1 file sharing (client + server)...
dism /Online /Enable-Feature /FeatureName:SMB1Protocol /All /NoRestart >nul 2>&1
dism /Online /Enable-Feature /FeatureName:SMB1Protocol-Client /All /NoRestart >nul 2>&1
dism /Online /Enable-Feature /FeatureName:SMB1Protocol-Server /All /NoRestart >nul 2>&1
echo SMB1 client + server enabled (reboot required to take effect).
:: SMB1 + DirectPlay: native on XP; must be re-enabled on Win10/11.
if "%ISXP%"=="0" (
echo Enabling SMB1 file sharing ^(client + server^)...
dism /Online /Enable-Feature /FeatureName:SMB1Protocol /All /NoRestart >nul 2>&1
dism /Online /Enable-Feature /FeatureName:SMB1Protocol-Client /All /NoRestart >nul 2>&1
dism /Online /Enable-Feature /FeatureName:SMB1Protocol-Server /All /NoRestart >nul 2>&1
echo SMB1 client + server enabled ^(reboot required to take effect^).
echo Enabling DirectPlay...
dism /Online /Enable-Feature /FeatureName:DirectPlay /All /NoRestart >nul 2>&1
echo DirectPlay enabled.
) else (
echo SMB1 and DirectPlay are native on XP - nothing to enable.
)
:: Create and share game-data folders (closed network open to Everyone).
:: Create and share game-data folders (closed network - open to Everyone).
echo Creating network shares...
if not exist "C:\mw4files" mkdir "C:\mw4files"
:: Grant Everyone modify on the NTFS side so the share grant is effective.
icacls "C:\mw4files" /grant *S-1-1-0:(OI)(CI)M /T >nul 2>&1
:: Recreate shares idempotently (net share fails if the name already exists).
if "%ISXP%"=="1" (
cacls "C:\mw4files" /T /E /G Everyone:C >nul 2>&1
) else (
icacls "C:\mw4files" /grant *S-1-1-0:(OI)(CI)M /T >nul 2>&1
)
net share mw4files /delete >nul 2>&1
net share mw4files=C:\mw4files /grant:Everyone,FULL >nul 2>&1
echo "Share \\%COMPUTERNAME%\mw4files -> C:\mw4files (Everyone: Full)"
@@ -182,146 +217,114 @@ net share c /delete >nul 2>&1
net share c=C:\ /grant:Everyone,FULL >nul 2>&1
echo "Share \\%COMPUTERNAME%\c -> C:\ (Everyone: Full)"
:: Join the site workgroup so every pod shares one browse list. Add-Computer
:: throws if the machine is already in that workgroup, so the error is ignored.
:: Takes effect on the reboot at the end of this script (same as the hostname
:: SecureConfig applies on first boot).
:: Join the site workgroup so every pod shares one browse list.
echo Joining workgroup "%WORKGROUP%"...
powershell -NoProfile -Command "try { Add-Computer -WorkgroupName '%WORKGROUP%' -Force -ErrorAction Stop } catch { }" >nul 2>&1
if "%ISXP%"=="1" (
wmic computersystem where "name='%COMPUTERNAME%'" call joindomainorworkgroup name="%WORKGROUP%" >nul 2>&1
) else (
powershell -NoProfile -Command "try { Add-Computer -WorkgroupName '%WORKGROUP%' -Force -ErrorAction Stop } catch { }" >nul 2>&1
)
echo Workgroup set to "%WORKGROUP%" (effective after reboot).
:: Enable DirectPlay (required by older games)
echo Enabling DirectPlay...
dism /Online /Enable-Feature /FeatureName:DirectPlay /All /NoRestart >nul 2>&1
echo DirectPlay enabled.
echo Done.
:: ── STEP 3: Install Windows Service ──────────────────────────────────────────
echo [3/8] Installing Windows Service...
sc create "%SERVICE_NAME%" ^
binPath= "\"%SERVICE_EXE%\"" ^
DisplayName= "%SERVICE_DISPLAY%" ^
start= delayed-auto ^
obj= LocalSystem ^
type= own
if %errorlevel% neq 0 (
echo ERROR: Failed to register Windows Service.
pause & exit /b 1
)
sc description "%SERVICE_NAME%" ^
"Tesla Application Launcher - accepts TeslaConsole connections and controls simulation software"
sc failure "%SERVICE_NAME%" ^
reset= 86400 actions= restart/5000/restart/10000/restart/30000
:: Delay auto-start by 20 seconds to let the network stack settle
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tesla Application Launcher" ^
/v AutoStartDelay /t REG_DWORD /d 20000 /f >nul
:: Set the global delayed-auto-start delay to 20 seconds (default is 120s)
reg add "HKLM\SYSTEM\CurrentControlSet\Control" ^
/v AutoStartDelay /t REG_DWORD /d 20000 /f >nul
echo Service registered: "%SERVICE_NAME%" (20s per-service delay, 20s global delay)
:: ── STEP 4: Disable Windows Firewall (closed network) ────────────────────────
echo.
echo [4/8] Disabling Windows Firewall (closed network)...
:: Disable firewall on all profiles — pods run on a closed network
netsh advfirewall set allprofiles state off
echo Windows Firewall disabled on all profiles.
:: ── STEP 5: Power settings (max performance, no sleep) ──────────────────────
echo.
echo [5/8] Configuring power settings...
:: Activate Ultimate Performance plan (hidden by default, GUID is well-known)
powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61 >nul 2>&1
for /f "tokens=4" %%g in ('powercfg -list ^| findstr /i "Ultimate"') do (
powercfg -setactive %%g
)
echo Ultimate Performance power plan activated.
:: Disable all sleep/hibernate/standby timeouts (AC power)
powercfg -change -standby-timeout-ac 0
powercfg -change -hibernate-timeout-ac 0
powercfg -change -monitor-timeout-ac 0
powercfg -change -disk-timeout-ac 0
powercfg -h off >nul 2>&1
echo Sleep, hibernate, monitor timeout, and disk timeout disabled.
:: ── STEP 6: Disable notifications ───────────────────────────────────────────
echo.
echo [6/8] Disabling notifications...
:: These are machine-wide Group Policy keys (HKLM) so they apply to EVERY user,
:: including the auto-login kiosk account. Per-user HKCU tweaks would only touch
:: the admin running this installer, not the account the pod actually runs as.
:: Remove Action Center / Notification Center entirely
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Explorer" ^
/v DisableNotificationCenter /t REG_DWORD /d 1 /f >nul
:: Kill all toast/app notifications (desktop and lock screen) and cloud toasts
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" ^
/v NoToastApplicationNotification /t REG_DWORD /d 1 /f >nul
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" ^
/v NoToastApplicationNotificationOnLockScreen /t REG_DWORD /d 1 /f >nul
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" ^
/v NoCloudApplicationNotification /t REG_DWORD /d 1 /f >nul
:: Suppress tips, suggestions, Spotlight, and other consumer content pop-ups
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent" ^
/v DisableSoftLanding /t REG_DWORD /d 1 /f >nul
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent" ^
/v DisableWindowsSpotlightFeatures /t REG_DWORD /d 1 /f >nul
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent" ^
/v DisableWindowsConsumerFeatures /t REG_DWORD /d 1 /f >nul
:: Silence Security & Maintenance (formerly Action Center) health notifications
reg add "HKLM\SOFTWARE\Microsoft\Windows Defender Security Center\Notifications" ^
/v DisableNotifications /t REG_DWORD /d 1 /f >nul
echo All Windows notifications disabled (machine-wide).
:: ── STEP 7: Disable UAC ─────────────────────────────────────────────────────
echo.
echo [7/8] Disabling UAC...
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" ^
/v EnableLUA /t REG_DWORD /d 0 /f >nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" ^
/v ConsentPromptBehaviorAdmin /t REG_DWORD /d 0 /f >nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" ^
/v PromptOnSecureDesktop /t REG_DWORD /d 0 /f >nul
echo UAC disabled (takes effect after reboot).
:: ── STEP 8: Configure Agent auto-start and auto-login ────────────────────────
echo.
echo [8/8] Configuring Agent auto-start and auto-login...
:: -- STEP 3: Launcher auto-start (no Windows Service on XP11) ----------------------
echo [3/7] Configuring launcher auto-start...
:: The single binary runs in the auto-logged-in user session. Restart-after-crash
:: comes from RegisterApplicationRestart (Vista+) inside the launcher itself.
set AUTORUN_KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
reg add "%AUTORUN_KEY%" /v "TeslaLauncherAgent" /t REG_SZ ^
/d "\"%AGENT_EXE%\"" /f >nul
echo Added TeslaLauncherAgent to HKLM\...\Run.
reg add "%AUTORUN_KEY%" /v "TeslaLauncher" /t REG_SZ ^
/d "\"%LAUNCHER_EXE%\"" /f >nul
echo Added TeslaLauncher to HKLM\...\Run (no service - single userland binary).
:: Auto-login: Winlogon reads these on every boot. AutoAdminLogon=1 tells
:: Winlogon to sign the DefaultUserName in with DefaultPassword without a
:: prompt. DefaultDomainName="." means the local machine account.
:: -- STEP 4: Disable Windows Firewall (closed network) -----------------------------
echo.
echo [4/7] Disabling Windows Firewall (closed network)...
if "%ISXP%"=="1" (
netsh firewall set opmode mode=disable >nul 2>&1
) else (
netsh advfirewall set allprofiles state off >nul
)
echo Windows Firewall disabled.
:: -- STEP 5: Power settings (max performance, no sleep) ----------------------------
echo.
echo [5/7] Configuring power settings...
if "%ISXP%"=="1" (
powercfg /setactive "Always On" >nul 2>&1
powercfg /change "Always On" /monitor-timeout-ac 0 >nul 2>&1
powercfg /change "Always On" /disk-timeout-ac 0 >nul 2>&1
powercfg /change "Always On" /standby-timeout-ac 0 >nul 2>&1
powercfg /hibernate off >nul 2>&1
echo "Always On" power scheme activated; sleep/hibernate disabled.
) else (
powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61 >nul 2>&1
for /f "tokens=4" %%g in ('powercfg -list ^| findstr /i "Ultimate"') do (
powercfg -setactive %%g
)
powercfg -change -standby-timeout-ac 0
powercfg -change -hibernate-timeout-ac 0
powercfg -change -monitor-timeout-ac 0
powercfg -change -disk-timeout-ac 0
powercfg -h off >nul 2>&1
echo Ultimate Performance plan activated; sleep/hibernate disabled.
)
:: -- STEP 6: Quiet the OS (notifications / UAC - modern Windows only) --------------
echo.
echo [6/7] Disabling notifications and UAC...
if "%ISXP%"=="1" (
echo XP has no Action Center or UAC - nothing to disable.
) else (
rem Machine-wide Group Policy keys (HKLM) so they apply to EVERY user,
rem including the auto-login kiosk account.
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Explorer" ^
/v DisableNotificationCenter /t REG_DWORD /d 1 /f >nul
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" ^
/v NoToastApplicationNotification /t REG_DWORD /d 1 /f >nul
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" ^
/v NoToastApplicationNotificationOnLockScreen /t REG_DWORD /d 1 /f >nul
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" ^
/v NoCloudApplicationNotification /t REG_DWORD /d 1 /f >nul
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent" ^
/v DisableSoftLanding /t REG_DWORD /d 1 /f >nul
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent" ^
/v DisableWindowsSpotlightFeatures /t REG_DWORD /d 1 /f >nul
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent" ^
/v DisableWindowsConsumerFeatures /t REG_DWORD /d 1 /f >nul
reg add "HKLM\SOFTWARE\Microsoft\Windows Defender Security Center\Notifications" ^
/v DisableNotifications /t REG_DWORD /d 1 /f >nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" ^
/v EnableLUA /t REG_DWORD /d 0 /f >nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" ^
/v ConsentPromptBehaviorAdmin /t REG_DWORD /d 0 /f >nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" ^
/v PromptOnSecureDesktop /t REG_DWORD /d 0 /f >nul
echo Notifications disabled; UAC disabled ^(takes effect after reboot^).
)
:: -- STEP 7: Auto-login --------------------------------------------------------------
echo.
echo [7/7] Configuring auto-login...
:: Winlogon reads these on every boot (same keys since NT). AutoAdminLogon=1
:: signs DefaultUserName in with DefaultPassword without a prompt.
set WINLOGON=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
reg add "%WINLOGON%" /v AutoAdminLogon /t REG_SZ /d "1" /f >nul
reg add "%WINLOGON%" /v DefaultUserName /t REG_SZ /d "%AUTOLOGIN_USER%" /f >nul
reg add "%WINLOGON%" /v DefaultPassword /t REG_SZ /d "%AUTOLOGIN_PASS%" /f >nul
reg add "%WINLOGON%" /v AutoAdminLogon /t REG_SZ /d "1" /f >nul
reg add "%WINLOGON%" /v DefaultUserName /t REG_SZ /d "%AUTOLOGIN_USER%" /f >nul
reg add "%WINLOGON%" /v DefaultPassword /t REG_SZ /d "%AUTOLOGIN_PASS%" /f >nul
reg add "%WINLOGON%" /v DefaultDomainName /t REG_SZ /d "." /f >nul
:: Re-arm auto-login after every sign-out (kiosk should never sit at a prompt).
reg add "%WINLOGON%" /v ForceAutoLogon /t REG_SZ /d "1" /f >nul
reg add "%WINLOGON%" /v ForceAutoLogon /t REG_SZ /d "1" /f >nul
:: Clear any logon-count cap that would disable auto-login after N boots.
reg delete "%WINLOGON%" /v AutoLogonCount /f >nul 2>&1
:: Some builds require this flag off for a plain-text auto-login password to
:: be honored (device-passwordless / Windows Hello preference).
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" ^
/v DevicePasswordLessBuildVersion /t REG_DWORD /d 0 /f >nul 2>&1
if "%ISXP%"=="0" (
rem Some Win10/11 builds require this flag off for a plain-text auto-login
rem password to be honored (device-passwordless preference).
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" ^
/v DevicePasswordLessBuildVersion /t REG_DWORD /d 0 /f >nul 2>&1
)
echo Auto-login configured for user "%AUTOLOGIN_USER%".
:: ── Done ──────────────────────────────────────────────────────────────────────
:: -- Done ----------------------------------------------------------------------------
echo.
echo ============================================================
echo Installation Complete!
@@ -332,9 +335,9 @@ echo Config dir : %DATA_DIR%
echo Firewall : disabled (closed network)
echo.
echo Rebooting in 10 seconds...
echo The Service and Agent will start automatically in the correct order.
echo On first boot with DHCP, SecureConfig runs automatically
echo watch plasma or on main screen for the Request ID and Passphrase.
echo The launcher starts automatically at login (single binary, no service).
echo On first boot with DHCP, SecureConfig runs automatically -
echo watch plasma or the main screen for the Request ID and Passphrase.
echo.
echo After reboot: use Console to install apps.
echo.