@echo off
set TOOLS=c:\tools
set THINUSER=THINCLIENT

set "FOLDER=%USERPROFILE%"
for /D %%D in ("%FOLDER%") do (
    set "PARENT=%%~dpD"
)

echo ####### %0 #######

echo Changing shell to explorer.exe ...
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" ^
  /v Shell /t REG_SZ /d "explorer.exe" /f 2>/nul

echo Deleting user %THINUSER% ...
net user %THINUSER% /DELETE
rd /S /Q %PARENT%%THINUSER% 2>nul

echo Enabling Lockscreen function ...
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" ^
  /v DisableLockWorkstation /t REG_DWORD /d "0" /f 2>/nul

echo Enabling fast User switching ...
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" ^
  /v HideFastUserSwitching /t REG_DWORD /d "0" /f 2>/nul

echo Disabling Auto Logon for user %THINUSER% ...
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" ^
  /v AutoAdminLogon /t REG_SZ /d "0" /f 2>/nul

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

echo.
echo Please REBOOT NOW.
echo.

echo ####### %0 #######

