feat(gameboot-windows): add auto-login and game launch task to fws gameboot installer

Enhance Install-FwsGameboot.ps1 with automatic login and game launch capabilities:

- Add -Password parameter for optional auto-login password configuration
- Verify prerequisites: local admin account and password requirements
- Deploy games.json configuration file alongside scripts
- Implement auto-login via Windows registry (AutoAdminLogon settings)
- Add scheduled task for auto-launching fws-play at user logon
- Tighten file ACLs on deployment directory (SYSTEM/Admins full, Users read-only)
- Replace hibernation note with full reboot explanation
- Enhance documentation with parameter descriptions and prerequisite validation details
- Update user warnings to reflect auto-login kiosk security implications

Workflow: boot → auto-login → fws-play launch → game execution → return to FWS.
This commit is contained in:
2026-07-08 03:21:02 +02:00
parent 9b80effc77
commit 11a531003e
@@ -1,44 +1,100 @@
<# <#
Install-FwsGameboot.ps1 — installe le composant de RETOUR FWS dans Windows. Install-FwsGameboot.ps1 — installe le composant de RETOUR + LANCEMENT AUTO.
A lancer UNE FOIS, EN ADMIN, dans le Windows gaming. Deploie les scripts, A lancer UNE FOIS, EN ADMIN, dans le Windows gaming. Met en place le
desactive l'hibernation/Fast Startup de Windows (pour un reboot PLEIN → NTFS "sans login, jeu lance tout seul" :
jamais "sale"), et cree une tache ONSTART (SYSTEM) qui arme le boot suivant - AUTO-LOGIN du compte gaming (pas d'ecran de mot de passe) ;
vers FWS des le demarrage — filet anti-crash : si Windows redemarre tout seul - tache AU LOGON qui lance fws-play (lit le jeton, lance le bon jeu, retour) ;
(Windows Update, plantage) sans passer par fws-play, le boot suivant repart - tache ONSTART qui arme le boot suivant vers FWS (filet anti-crash) ;
vers FWS. - powercfg /h off (reboot PLEIN → NTFS jamais "sale").
Empreinte minimale et SANS interference avec Vanguard : aucune injection, PREREQUIS VERIFIES par ce script (echec explicite sinon) :
aucun pilote/hook noyau — juste des scripts, une tache planifiee et un reglage - le compte courant est ADMINISTRATEUR local (bcdedit + taches SYSTEM) ;
d'alimentation. - le compte n'a PAS de mot de passe, OU -Password est fourni.
Empreinte minimale, SANS interference avec Vanguard (aucune injection/hook noyau).
Parametres :
-Password <str> Mot de passe du compte pour l'auto-login. OMETTRE si le
compte n'a pas de mot de passe. Fourni => stocke EN CLAIR
dans le registre (limitation AutoAdminLogon) : preferer
Sysinternals Autologon.exe (secret LSA chiffre).
#> #>
#Requires -RunAsAdministrator #Requires -RunAsAdministrator
param([string]$Password)
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
# --- Prereq 1 : le compte gaming DOIT etre admin local (SID, locale-independant) ---
try {
$adminGrp = (Get-LocalGroup -SID 'S-1-5-32-544').Name # "Administrators"/"Administrateurs"
$members = Get-LocalGroupMember -Group $adminGrp -ErrorAction Stop
$isAdmin = $members | Where-Object { $_.Name -ieq "$Env:COMPUTERNAME\$Env:USERNAME" -or $_.Name -ieq $Env:USERNAME }
} catch { $isAdmin = $null }
if (-not $isAdmin) {
throw "Le compte '$Env:USERNAME' doit etre ADMINISTRATEUR local : fws-play appelle bcdedit et pilote des taches SYSTEM. Ajoute-le au groupe administrateurs puis relance."
}
# --- Prereq 2 : auto-login fiable => compte sans mot de passe OU -Password fourni ---
$pwdRequired = $true
try { $pwdRequired = (Get-LocalUser -Name $Env:USERNAME).PasswordRequired } catch { }
if ($pwdRequired -and -not $PSBoundParameters.ContainsKey('Password')) {
throw "Le compte '$Env:USERNAME' exige un mot de passe : relance avec -Password '<mdp>', ou retire le mot de passe du compte. Sinon l'auto-login echoue -> ecran de connexion -> la boucle gameboot se bloque."
}
# --- Deploiement des scripts + durcissement ACL (exe potentiellement lance ELEVE) ---
$dest = Join-Path $Env:ProgramData 'FWS' $dest = Join-Path $Env:ProgramData 'FWS'
New-Item -ItemType Directory -Force -Path $dest | Out-Null New-Item -ItemType Directory -Force -Path $dest | Out-Null
Copy-Item (Join-Path $PSScriptRoot 'fws-return.ps1') $dest -Force foreach ($f in 'fws-return.ps1','fws-play.ps1','games.json') {
Copy-Item (Join-Path $PSScriptRoot 'fws-play.ps1') $dest -Force Copy-Item (Join-Path $PSScriptRoot $f) $dest -Force
}
# SYSTEM + Administrateurs = plein controle ; Utilisateurs = lecture seule ; heritage retire.
& icacls $dest /inheritance:r /grant:r 'SYSTEM:(OI)(CI)F' '*S-1-5-32-544:(OI)(CI)F' '*S-1-5-32-545:(OI)(CI)RX' | Out-Null
# (1) Pas d'hibernation Windows / Fast Startup : reboot PLEIN → volumes propres. # (1) Reboot PLEIN : pas de Fast Startup → volumes propres.
& powercfg /h off 2>$null & powercfg /h off 2>$null
# (2) Tache ONSTART (SYSTEM) : armer le boot suivant vers FWS au demarrage. # (2) AUTO-LOGIN du compte courant.
$action = New-ScheduledTaskAction -Execute 'powershell.exe' ` $winlogon = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon'
Set-ItemProperty $winlogon 'AutoAdminLogon' '1' -Force
Set-ItemProperty $winlogon 'ForceAutoLogon' '1' -Force
Set-ItemProperty $winlogon 'DefaultUserName' $Env:USERNAME -Force
Set-ItemProperty $winlogon 'DefaultDomainName' '.' -Force # '.' = local, immune au renommage
if ($PSBoundParameters.ContainsKey('Password')) {
Set-ItemProperty $winlogon 'DefaultPassword' $Password -Force
Write-Warning "Mot de passe stocke EN CLAIR dans le registre. Preferer Sysinternals Autologon.exe (LSA chiffre)."
} else {
Remove-ItemProperty $winlogon 'DefaultPassword' -ErrorAction SilentlyContinue
Write-Host "Auto-login sans mot de passe stocke (compte sans mot de passe verifie)."
}
# (3) Tache AU LOGON : lancer fws-play (lit le jeton, lance le jeu, gere le retour).
$playAction = New-ScheduledTaskAction -Execute 'powershell.exe' `
-Argument ('-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File "{0}\fws-play.ps1"' -f $dest)
$playTrigger = New-ScheduledTaskTrigger -AtLogOn -User $Env:USERNAME
$playPrincipal = New-ScheduledTaskPrincipal -UserId $Env:USERNAME -LogonType Interactive -RunLevel Highest
$playSettings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
Register-ScheduledTask -TaskName 'FWS-Play-OnLogon' -Action $playAction -Trigger $playTrigger `
-Principal $playPrincipal -Settings $playSettings -Force | Out-Null
# (4) Tache ONSTART (SYSTEM) : armer le boot suivant vers FWS au demarrage.
# Filet anti-crash : si Windows redemarre seul (WU, plantage) sans fws-play,
# le boot suivant repart vers FWS. fws-play RE-AFFIRME Windows apres lancement
# (gere la course avec cette tache — voir fws-play.ps1).
$retAction = New-ScheduledTaskAction -Execute 'powershell.exe' `
-Argument ('-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File "{0}\fws-return.ps1" -Target FWS' -f $dest) -Argument ('-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File "{0}\fws-return.ps1" -Target FWS' -f $dest)
$trigger = New-ScheduledTaskTrigger -AtStartup $retTrigger = New-ScheduledTaskTrigger -AtStartup
$principal = New-ScheduledTaskPrincipal -UserId 'SYSTEM' -LogonType ServiceAccount -RunLevel Highest $retPrincipal = New-ScheduledTaskPrincipal -UserId 'SYSTEM' -LogonType ServiceAccount -RunLevel Highest
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries $retSettings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
Register-ScheduledTask -TaskName 'FWS-Return-OnStart' -Action $action -Trigger $trigger ` Register-ScheduledTask -TaskName 'FWS-Return-OnStart' -Action $retAction -Trigger $retTrigger `
-Principal $principal -Settings $settings -Force | Out-Null -Principal $retPrincipal -Settings $retSettings -Force | Out-Null
Write-Host "" Write-Host ""
Write-Host "Composant FWS installe dans $dest et tache 'FWS-Return-OnStart' creee." -ForegroundColor Green Write-Host "Composant FWS installe dans $dest." -ForegroundColor Green
Write-Host "Auto-login + lancement auto du jeu configures. Flux : boot -> login auto -> jeu." -ForegroundColor Green
Write-Host "" Write-Host ""
Write-Host "RAPPELS IMPORTANTS :" -ForegroundColor Yellow Write-Host "RAPPELS IMPORTANTS :" -ForegroundColor Yellow
Write-Host " - NE PAS activer BitLocker (Device Encryption) sans sauvegarder la cle :" Write-Host " - POSTE KIOSQUE : auto-login + taches non-UAC => acces physique = bureau admin."
Write-Host " le passage de Secure Boot OFF->ON cote FWS change PCR7 et declencherait" Write-Host " - NE PAS activer BitLocker sans sauvegarder la cle (flip Secure Boot cote FWS"
Write-Host " l'ecran de recuperation BitLocker. (Verifie : manage-bde -status)" Write-Host " change PCR7 -> ecran de recuperation). Verifie : manage-bde -status"
Write-Host " - Pour un lancement AUTO de Valorant : ajouter fws-play.ps1 au demarrage" Write-Host " - Ne desactive pas Secure Boot / TPM / VBS-HVCI : Vanguard les exige."
Write-Host " de session du compte gaming (autologin), sinon lance-le a la main." Write-Host " - Ajouter des jeux : editer $dest\games.json (id en [a-z0-9_-])."
Write-Host " - Vanguard exige Secure Boot + TPM 2.0 + VBS/HVCI : ne les desactive pas."