Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for seclogin.bat

(view source code of seclogin.bat as plain text)

  1. @ECHO OFF
  2. :: Not for Windows 9x nor MS-DOS
  3. IF NOT "%OS%"=="Windows_NT" GOTO Syntax
  4.  
  5. :: Localize the environment variable used
  6. SETLOCAL
  7.  
  8. :: Only 1 command line argument allowed
  9. IF NOT "%~2"=="" GOTO Syntax
  10.  
  11. :: Windows XP only
  12. VER | FIND "5.1." >NUL || GOTO Syntax
  13.  
  14. :: Command line argument can only be a valid computer name
  15. ECHO.%~1 | FINDSTR /R /C:"[/?\*:;,@\\\+]" >NUL && GOTO Syntax
  16. IF NOT "%~1"=="" (
  17. 	PING %1 -n 2 2>NUL | FIND "TTL=" >NUL
  18. 	IF ERRORLEVEL 1 (
  19. 		GOTO Syntax
  20. 	) ELSE (
  21. 		SET RemotePC=%~1
  22. 		SET RemotePC=%RemotePC:\=%
  23. 	)
  24. )
  25.  
  26. :: Do NOT display the last user name at logon
  27. :: REG Add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies" /v DontDisplayLastUserName /t REG_DWORD /d 1 /f
  28. REG Add "%RemotePC%HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies" /v DontDisplayLastUserName /t REG_DWORD /d 1 /f
  29.  
  30. :: Require Ctrl+Alt+DEl at logon
  31. REG Add "%RemotePC%HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DisableCAD /t REG_DWORD /d 0 /f
  32.  
  33. :: Use "classic" login screen instead of XP Welcome screen
  34. REG Add "%RemotePC%HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v LogonType  /t REG_DWORD /d 0 /f
  35.  
  36. :: Done
  37. ENDLOCAL
  38. GOTO:EOF
  39.  
  40.  
  41. :Syntax
  42. ECHO SecLogin.bat,  Version 1.00 for Windows XP
  43. ECHO Make Windows XP's logon more secure by using the "classic" login dialog
  44. ECHO instead of the welcome screen, disabling the display of the last user name
  45. ECHO at logon, and requiring Ctrl+Alt+Del to logon
  46. ECHO.
  47. ECHO Usage:  SECLOGIN  [ remote ]
  48. ECHO.
  49. ECHO Where   remote    is an optional remote computer name to which the changes
  50. ECHO                   should be applied (default is the local computer)
  51. ECHO.
  52. ECHO Note:   This batch file modifieds the registry, which is always risky.
  53. ECHO         Use this batch file entirely at your own risk.
  54. ECHO         Make sure you have a tested full backup and the appropriate restore
  55. ECHO         software available before running this batch file.
  56. ECHO.
  57. ECHO Written by Rob van der Woude
  58. ECHO http://www.robvanderwoude.com
  59.  
  60. IF "%OS%"=="Windows_NT" ENDLOCAL
  61.  

page last uploaded: 2017-08-21, 14:26