Setuser.bat
@echo off
if "%1"=="" goto error
if "%1"=="?" goto help
if "%1"=="/?" goto help
if "%1"=="help" goto help
if "%1"=="/" goto help
if "%1"=="/help" goto help
set tmpfile=C:\temp.reg
echo REGEDIT4>%tmpfile%
echo.>>%tmpfile%
rem This line blanks out the NT user name (The Novell client will pass the *Novell logon name to this key after successful login)
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\* Winlogon]>>%tmpfile%
echo "DefaultUserName"="">>%tmpfile%
rem This line resets the NT Login Only check box to disabled (it unchecks it)
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Novell\NWGINA\Login Screen]>>%tmpfile%
echo "DefaultNWLoginFlags"=dword:00000509>>%tmpfile%
rem This line gets the variable from the command prompt (the username)
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Novell\NWGINA\Login Screen]>>%tmpfile%
echo "DefaultNetwareUserName"="%1">>%tmpfile%
rem This line get the next variable from the command prompt (the context)
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Novell\NWGINA\Login Screen]>>%tmpfile%
echo "DefaultNDSContext"="%2">>%tmpfile%
call regedit %tmpfile%
del %tmpfile%
cls
goto exit
:error
cls
(continued on page 50)
LISTING 4 (continued)
@echo off
echo.
echo !!! You must specify the parameters: Type "setuser ?" for help
pause
cls
goto exit
:help
cls
@echo off
echo.
echo ****************** SETUSER ***********************
echo **************************************************
echo *** The correct syntax for this command is:***
echo ******
echo *** c:\setuser username context***
echo ******
echo *** example: setuser syssjp is.nste.nsc***
echo ******
echo *** The "NT Logon only" check box will***
echo *** automatically be cleared as well***
echo *** -------------------------------------***
echo *** Remember you must be logged into NT***
echo *** with administrator rights...***
echo *** -------------------------------------***
echo **************************************************
pause
cls
:exit