Configure Auto-Login to NT/2000/XP only and disable the Novell Login screen.
________________________________________________________________________________________________
@ECHO OFF
:: Configure Auto-Login to NT/2000/XP only and disable the Novell Login screen.
:: For Novell Client versions 4.7 thru 4.9
:: Similar to the 'Workstation Only' checkbox.
:: Save or rename this file extension as AutoLog.BAT not AutoLog.txt to use.
:: If the primary connection's password expires when running the NetWare Login
:: utility from the icon, then the user will be given the chance to synchronize
:: all NetWare and NT passwords. Users should not synchronize the NT password,
:: because NetWare Login does not update the Registry settings for auto-logon.
:: Using AutoAdminLogon opens your network to a security risk, as it exposes
:: user IDs and passwords and it lets any user who starts the workstation use
:: these embedded credentials.
:: Since writing this, this utility was discovered by Tommy Mikkelsen:
:: www.novell.com/coolsolutions/tools/1035.html
:: THIS BATCH FILE HAS NOT BEEN WIDELY TESTED. GREAT CARE HAS BEEN TAKEN TO
:: ENSURE THAT THIS BATCH FILE PERFORMS AS IT SHOULD. IT IS PROVIDED "AS IS",
:: BY USING THIS BATCH FILE, YOU AGREE TO USE IT AT YOUR OWN RISK.
IF "%1"=="~" GOTO ~
IF NOT "%USERNAME%"=="" GOTO 1
ECHO WARNING: No USERNAME environment variable, do not use this utility.
ECHO.
:1
IF "%USERDOMAIN%"=="%COMPUTERNAME%" GOTO 2
ECHO CAUTION: Domain "%USERDOMAIN%" is not "%COMPUTERNAME%" for this local machine.
ECHO.
:2
IF "%NWUSERNAME%"=="" GOTO 3
ECHO CAUTION: Not loggin-off %NWUSERNAME% may cause log-off problems this session.
ECHO.
:3
IF NOT "%1"=="" IF NOT "%1"=="/?" GOTO 4
ECHO Configures Auto-Login to NT/2000/XP only and disables the Novell Login screen.
ECHO Similar to the Workstation Only checkbox.
ECHO.
ECHO USAGE: %0 [%USERNAME%'s password, or 0 / OFF / DISABLE]
ECHO.
ECHO NOTE: Requires local "%USERNAME%" user to temporarily include membership of
ECHO ` Administrators to permit these changes, or alternatively use:
ECHO ` RUNAS /user:[Administrator] /env "CMD /c %0 [...]"
ECHO ` Running a Windows Update afterwards may cause login problems.
ECHO.
PAUSE
GOTO X
:4
SET D=%TEMP%\REG-Temp
IF NOT EXIST %D%\NUL MD %D%
SET F=%D%\AutoLog.REG
SET A=1
FOR %%F IN (disable,Disable,DISABLE,off,Off,OFF,0) DO IF "%1"=="%%F" SET A=0
:: Build temporary .REG Registry File
>%F% ECHO REGEDIT4
>>%F% ECHO.
>>%F% ECHO [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon]
>>%F% ECHO "AutoAdminLogon"="%A%"
:: The NT AutoAdminLogin reads the WinLogon setting, but this information is cascaded
:: from the values contained in Novell's Location Profiles below, so they are the ones
:: that need to be set correctly. However, the DefaultPassword is not cascaded from any
:: Novell controlled registry value, so this will need to be set in the WinLogon key.
:: If no DefaultPassword string is specified, the value of the AutoAdminLogon key
:: automatically changes from 1 (True) to 0 (False).
CALL %0 ~ DefaultDomainName "%COMPUTERNAME%"
CALL %0 ~ DefaultUserName "%USERNAME%"
CALL %0 ~ DefaultPassword "%1"
:: To bypass this automatic logon, to log-on as a different user, hold down the
:: Shift key after a logout or after Windows restarts, or logoff from the initial
:: transparently logged-on session (not Windows NT 4.0).
CALL %0 ~ ForceAutoLogon "0"
>>%F% ECHO.
>>%F% ECHO [HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Location Profiles\Services\{1E6CEEA1-FB73-11CF-BD76-00001B27DA23}\Default\Tab3]
CALL %0 ~ DefaultDomainName "%COMPUTERNAME%"
CALL %0 ~ DefaultUserName "%USERNAME%"
>>%F% ECHO.
>>%F% ECHO [HKEY_LOCAL_MACHINE\Software\Novell\Login]
>>%F% ECHO "AutoAdminLogon"="0"
:: This key controls whether the Novell GUI Login screen will pop-up and allow a
:: different user to NDS. This pop-up cannot be cancelled. For a cancellable pop-up,
:: add Novel Login (Shortcut to loginw32.exe) to the user's Start Menu\Programs\Startup
IF "%A%"=="0" ECHO "AutoAdminQueryNDS"=dword:00000001>>%F%
IF "%A%"=="1" ECHO "AutoAdminQueryNDS"=dword:00000000>>%F%
:: Prevent any other prompts for the user password
IF "%A%"=="0" GOTO 5
>>%F% ECHO.
>>%F% ECHO [HKEY_CURRENT_USER\Control Panel\Desktop]
>>%F% ECHO "ScreenSaverIsSecure"="0"
START CONTROL.EXE powercfg.cpl
ECHO HELP: Under the Advanced tab of the Power Options Properties,
ECHO uncheck "Prompt for password when computer resumes from standby"
ECHO.
:5
:: Import temporary .REG Registry File and clean-up
START /WAIT REGEDIT.EXE /S %F%
IF "%A%"=="0" ECHO Auto-Login was removed.
IF "%A%"=="1" ECHO Auto-Login to local user "%USERNAME%" configured.
ECHO Delete temporary directory %D%,
DEL %D%\*.*
IF NOT EXIST %F% RD %D%
SET D=
SET F=
SET A=
GOTO X
:~
IF "%A%"=="0" ECHO "%2"=->>%F%
IF "%A%"=="1" ECHO "%2"=%3 %4 %5 %6 %7 %8 %9>>%F%
:X