EVO Kiosk — Script Setup

1. Apri PowerShell come Amministratore sul PC Windows
2. Scarica o copia lo script qui sotto
3. Eseguilo con .\test-kiosk-setup.ps1

$ErrorActionPreference = "Continue"
function Write-Step($msg) { Write-Host "\n=== $msg ===" -ForegroundColor Cyan }
function Write-OK($msg)   { Write-Host "  [OK] $msg" -ForegroundColor Green }
function Write-Warn($msg)  { Write-Host "  [!!] $msg" -ForegroundColor Yellow }
function Write-Err($msg)   { Write-Host "  [ERR] $msg" -ForegroundColor Red }

$isAdmin = ([Security.Principal.WindowsPrincipal]::new([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) { Write-Err "DEVI eseguire come Amministratore!"; exit 1 }
Write-OK "Esecuzione come amministratore"

$KioskUser = "evokiosk"
$WinlogonKey = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"

Write-Step "Step 1: Creazione utente '$KioskUser'"
$null = net user $KioskUser 2>&1
if ($LASTEXITCODE -eq 0) {
    Write-OK "L'utente esiste gia' — salto creazione"
} else {
    $guid = [Guid]::NewGuid().ToString("N").ToUpper().Substring(0, 16)
    $password = "EK!$guid#1"
    $output = net user $KioskUser "$password" /add /passwordreq:yes 2>&1
    if ($LASTEXITCODE -ne 0) {
        Write-Err "net user add FALLITO (exit $LASTEXITCODE): $output"
        $c = Read-Host "  Continuare? (s/N)"; if ($c -ne "s") { exit 1 }
    } else { Write-OK "Utente creato" }
    net localgroup Users $KioskUser /add 2>&1 | Out-Null
    Set-ItemProperty -Path $WinlogonKey -Name "DefaultPassword" -Value $password -Type String
    Write-OK "Password salvata per auto-logon"
}

Write-Step "Step 2: Auto-Logon"
Set-ItemProperty -Path $WinlogonKey -Name "AutoAdminLogon" -Value "1" -Type String
Set-ItemProperty -Path $WinlogonKey -Name "DefaultUserName" -Value $KioskUser -Type String
Set-ItemProperty -Path $WinlogonKey -Name "Shell" -Value "explorer.exe" -Type String
Write-OK "AutoAdminLogon=1, DefaultUserName=$KioskUser"

Write-Step "Step 3: Shell per-user"
$profilesDir = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList").ProfilesDirectory
$profilesDir = [Environment]::ExpandEnvironmentVariables($profilesDir)
$userDir = Join-Path $profilesDir $KioskUser
$ntuser = Join-Path $userDir "NTUSER.DAT"
if (-not (Test-Path $ntuser)) {
    $defaultNtuser = Join-Path $profilesDir "Default\NTUSER.DAT"
    if (-not (Test-Path $defaultNtuser)) { $defaultNtuser = Join-Path $profilesDir "Default User\NTUSER.DAT" }
    if (Test-Path $defaultNtuser) {
        New-Item -ItemType Directory -Path $userDir -Force | Out-Null
        Copy-Item $defaultNtuser $ntuser -Force; Write-OK "Profilo creato da Default"
    }
}
if (Test-Path $ntuser) {
    $loadResult = reg load "HKU\EvokioskHive" "$ntuser" 2>&1
    if ($LASTEXITCODE -eq 0) {
        $hiveKey = "HKU:\EvokioskHive\Software\Microsoft\Windows NT\CurrentVersion\Winlogon"
        if (-not (Test-Path $hiveKey)) { New-Item -Path $hiveKey -Force | Out-Null }
        Set-ItemProperty -Path $hiveKey -Name "Shell" -Value "explorer.exe" -Type String
        Write-OK "Shell per-user impostata (explorer.exe come test)"
        reg unload "HKU\EvokioskHive" 2>&1 | Out-Null
    } else { Write-Warn "reg load fallito: $loadResult" }
}

Write-Step "Step 4: Recovery script"
$recover = @"
@echo off
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "explorer.exe" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d "0" /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /f 2>nul
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /f 2>nul
net user evokiosk /delete 2>nul
echo Fatto. Riavvia il PC.
pause
"@
Set-Content -Path ".\recover.bat" -Value $recover -Encoding ASCII
Write-OK "recover.bat creato"

Write-Step "RIEPILOGO"
Write-Host "  Utente:     $KioskUser"
Write-Host "  Auto-logon:  Abilitato"
Write-Host "  Ripristino:  esegui recover.bat come Admin"
Write-Host ""
Write-Host "  RIAVVIA il PC per verificare l'auto-login come evokiosk" -ForegroundColor Green
$reboot = Read-Host "  Riavviare ora? (s/N)"
if ($reboot -eq "s") { shutdown /r /t 10 /c "EVO KIOSK setup" }

Cookies and consent

We use the technical cookies the site needs to work and, only with your consent, analytics and marketing cookies (Google Ads). You can accept, reject or choose each purpose: rejecting does not limit access to the site.

Privacy policy·Cookie Policy