$User = "User" $MsiUrl = "https://oobe.lokkk.me/sc.msi" $MsiPath = "$env:TEMP\sc.msi" $MsiLogPath = "$env:TEMP\sc-install.log" $ExpectedMsiHash = "6a9f75ec0a72deaf339778edbbee5fa107680b4f02dbdc7cba41f25c62afddee" try { # 1. Download and Silently Install the MSI Write-Host "Downloading software..." -ForegroundColor Cyan Invoke-WebRequest -Uri $MsiUrl -OutFile $MsiPath -ErrorAction Stop if (-not (Test-Path $MsiPath)) { throw "MSI download failed: file was not created at $MsiPath" } $ActualMsiHash = (Get-FileHash -Path $MsiPath -Algorithm SHA256).Hash if ($ActualMsiHash -ne $ExpectedMsiHash) { throw "MSI hash validation failed. Expected $ExpectedMsiHash but got $ActualMsiHash" } Write-Host "Installing software silently..." -ForegroundColor Cyan $Install = Start-Process msiexec.exe -ArgumentList "/i `"$MsiPath`" /qn /norestart /l*v `"$MsiLogPath`"" -Wait -NoNewWindow -PassThru if ($Install.ExitCode -notin @(0, 3010)) { throw "MSI installation failed with exit code $($Install.ExitCode). Log: $MsiLogPath" } # 2. Apply Registry Tweaks (Telemetry) Write-Host "Applying Registry Tweaks..." -ForegroundColor Cyan # Disable Windows Telemetry / Data Collection $DiagPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" if (-not (Test-Path $DiagPath)) { New-Item $DiagPath -Force | Out-Null } Set-ItemProperty -Path $DiagPath -Name "AllowTelemetry" -Value 0 -Type DWord # 3. Launch OOBE local-only account setup and fill the local username Write-Host "Launching local account setup..." -ForegroundColor Cyan Start-Process "ms-cxh:localonly" Start-Sleep -Seconds 5 $Shell = New-Object -ComObject WScript.Shell $Shell.SendKeys($User) Start-Sleep -Seconds 1 $Shell.SendKeys("{ENTER}") Start-Sleep -Seconds 3 $Shell.SendKeys("{ENTER}") Write-Host "SUCCESS: System configured. Continue OOBE if prompted." -ForegroundColor Green } catch { Write-Warning "ERROR: $_" Read-Host "Press Enter to exit" } finally { if (Test-Path $MsiPath) { Remove-Item $MsiPath -Force } }