Breakthrough change

This commit is contained in:
2026-11-14 22:12:04 +07:00
parent 65908617c3
commit 1a4774e376
12 changed files with 806 additions and 116 deletions
+127
View File
@@ -0,0 +1,127 @@
@echo off
setlocal EnableDelayedExpansion
:: ============================================================================
:: 0. AUTO-ELEVATE TO ADMINISTRATOR
:: ============================================================================
net session >nul 2>&1
if %errorLevel% neq 0 (
echo Requesting Administrator privileges...
powershell -NoProfile -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
exit /b
)
echo ============================================================================
echo DTS TORQUE VAULT - UNINSTALL KIOSK & RESTORE WINDOWS NORMAL MODE
echo ============================================================================
echo.
:: Detect current Auto-Logon user automatically
set "DETECTED_USER="
for /f "tokens=2*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultUserName" 2^>nul') do set "DETECTED_USER=%%B"
if not "%DETECTED_USER%"=="" (
echo Detected configured Kiosk user: "%DETECTED_USER%"
set /p KIOSK_USER="Enter Kiosk username to restore/remove [Default: %DETECTED_USER%]: "
if "!KIOSK_USER!"=="" set "KIOSK_USER=%DETECTED_USER%"
) else (
set /p KIOSK_USER="Enter Kiosk username to restore/remove (leave blank to skip user restore): "
)
echo.
set /p DEL_USER="Do you want to DELETE the local user account '%KIOSK_USER%' completely? (Y/N) [N = Keep user & restore normal Desktop]: "
set /p DEL_DATA="Do you want to DELETE Kiosk app & browser data (C:\KioskApp, C:\KioskBrowserData)? (Y/N): "
set /p DEL_WSL="Do you want to REMOVE Docker containers and Ubuntu-22.04 WSL distro? (Y/N): "
echo.
:: ============================================================================
:: 1. DISABLE WINDOWS AUTO-LOGON & CLEAN RUNONCE
:: ============================================================================
echo [1/5] Disabling Windows Auto-Logon...
set "WINLOGON_KEY=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
reg add "%WINLOGON_KEY%" /v "AutoAdminLogon" /t REG_SZ /d "0" /f >nul
reg delete "%WINLOGON_KEY%" /v "DefaultUserName" /f >nul 2>&1
reg delete "%WINLOGON_KEY%" /v "DefaultPassword" /f >nul 2>&1
reg delete "%WINLOGON_KEY%" /v "DefaultDomainName" /f >nul 2>&1
reg delete "%WINLOGON_KEY%" /v "AutoLogonCount" /f >nul 2>&1
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "DTS_Master_Setup" /f >nul 2>&1
:: ============================================================================
:: 2. REMOVE EDGE KIOSK POLICIES
:: ============================================================================
echo [2/5] Removing Microsoft Edge Kiosk policies...
set "EDGE_POL=HKLM\SOFTWARE\Policies\Microsoft\Edge"
reg delete "%EDGE_POL%" /v "InPrivateModeAvailability" /f >nul 2>&1
reg delete "%EDGE_POL%" /v "ClearBrowsingDataOnExit" /f >nul 2>&1
reg delete "%EDGE_POL%" /v "RestoreOnStartup" /f >nul 2>&1
:: ============================================================================
:: 3. REMOVE SCHEDULED TASKS
:: ============================================================================
echo [3/5] Removing Kiosk and WSL Auto-Start Scheduled Tasks...
schtasks /delete /tn "DTS_WSL_Docker_AutoStart" /f >nul 2>&1
schtasks /delete /tn "DTS_Torque_Vault_Kiosk" /f >nul 2>&1
:: ============================================================================
:: 4. RESTORE NORMAL DESKTOP SHELL OR DELETE KIOSK USER ACCOUNT
:: ============================================================================
echo [4/5] Restoring or removing Kiosk user "%KIOSK_USER%"...
if not "%KIOSK_USER%"=="" (
if /i not "%KIOSK_USER%"=="%USERNAME%" (
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"$user = '%KIOSK_USER%';" ^
"$delUser = '%DEL_USER%';" ^
"$acc = Get-LocalUser -Name $user -ErrorAction SilentlyContinue;" ^
"if ($acc) {" ^
" $sid = $acc.SID.Value;" ^
" $profReg = \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$sid\";" ^
" $profilePath = (Get-ItemProperty $profReg -ErrorAction SilentlyContinue).ProfileImagePath;" ^
" if ($profilePath -and (Test-Path (Join-Path $profilePath 'NTUSER.DAT'))) {" ^
" $hivePath = Join-Path $profilePath 'NTUSER.DAT';" ^
" $loaded = $false;" ^
" if (-not (Test-Path \"Registry::HKEY_USERS\$sid\")) { reg load \"HKU\$sid\" \"$hivePath\" >$null 2>&1; if ($LASTEXITCODE -eq 0) { $loaded = $true; } }" ^
" if (Test-Path \"Registry::HKEY_USERS\$sid\") {" ^
" Remove-ItemProperty -Path \"Registry::HKEY_USERS\$sid\Software\Microsoft\Windows\CurrentVersion\Policies\System\" -Name 'Shell' -ErrorAction SilentlyContinue;" ^
" }" ^
" if ($loaded) { [gc]::Collect(); Start-Sleep -Milliseconds 300; reg unload \"HKU\$sid\" >$null 2>&1; }" ^
" }" ^
" if ($delUser -ieq 'Y') {" ^
" Write-Host (' - Deleting user account and profile for ' + $user + '...');" ^
" Get-CimInstance -ClassName Win32_UserProfile | Where-Object { $_.SID -eq $sid } | Remove-CimInstance -ErrorAction SilentlyContinue;" ^
" Remove-LocalUser -Name $user -ErrorAction SilentlyContinue;" ^
" } else {" ^
" Write-Host (' - Normal Windows Desktop restored for ' + $user + '.');" ^
" }" ^
"}"
) else (
echo - Skipping current logged-in Administrator account for safety.
)
)
:: ============================================================================
:: 5. CLEAN UP KIOSK FOLDERS, POWER PLAN & OPTIONAL WSL/DOCKER REMOVAL
:: ============================================================================
echo [5/5] Restoring Power Plan and cleaning up files...
:: Restore Balanced Power Plan
powercfg -setactive 381b4222-f694-41f0-9685-ff5bb260df2e >nul 2>&1
if /i "%DEL_DATA%"=="Y" (
echo - Removing C:\KioskApp and C:\KioskBrowserData...
rd /s /q "C:\KioskApp" >nul 2>&1
rd /s /q "C:\KioskBrowserData" >nul 2>&1
)
if /i "%DEL_WSL%"=="Y" (
echo - Stopping containers and unregistering Ubuntu-22.04 WSL...
wsl -d Ubuntu-22.04 -u root bash -c "cd /opt/walmart && docker compose down -v" >nul 2>&1
wsl --unregister Ubuntu-22.04 >nul 2>&1
)
echo.
echo ============================================================================
echo UNINSTALL COMPLETED! MINI PC RESTORED TO NORMAL WINDOWS MODE.
echo ============================================================================
echo.
set /p REBOOT_NOW="Reboot now to apply changes? (Y/N): "
if /i "%REBOOT_NOW%"=="Y" shutdown /r /t 3
pause