I found this complex and yet useful script on another forum
Thanks to dragon-it on Experts Exchange for that one
If you are using just W2K clients then you can also add login scripts through Group Policy for all users under a particular OU in Active Directory (or you can specify which users by applying a group too).
You right click on an OU in Active Directory Users & Computers, select Properties, and Add a new Group Policy. Have a look down the options and you'll find Scripts entries for Logon and Logoff that can be run by Users and for PC's at Startup and Shutdown (before user logs in).
If you don't have just W2K clients you'll have to stick with the old way for now.
The following extract of a login script shows you the use of the ifmember.exe command which you can use to set different drive mappings etc. depending upon which groups a person is in. This command comes with the NT/W2K Resource Kit and you can use that with either a Group Policy or normal login script.
It also has some error checking so that the script stops at the end if an error occurs in mapping one of the drives.
Steve
@echo off
SET LS_Error=
Echo *** Turn off persistent mappings for NT / 2000 ***
net use /persistent:no
Echo *** Set time from server ***
net time \\PDC_NAME /set /yes
if errorlevel 1 set LS_Error=SET TIME
ifmember "DOMAIN\Map_System Root to G"
if not errorlevel 1 goto SkipG
echo *** Map Root drive ***
net use g: \\FILESERVER\Root
if errorlevel 1 set LS_Error=%LS_Error% G (ROOT)
:SkipG
Echo *** Map Apps drives ***
net use h: \\FILESERVER\Applications
if errorlevel 1 set LS_Error=%LS_Error% H (APPS)
echo *** Logging PC usage ***
\\FILESERVER\policies\LoginAudit.exe
REM rather than using Home drive in user property
REM this sets a home drive just by username
Echo *** Map Home drives ***
if "%username%"=="" set LS_NoName=TRUE
if "%username%"=="" goto skipI
net use i: \\FILESERVER\users\%username%
if errorlevel 1 set LS_Error=%LS_Error% I (HOME)
:skipI
Echo *** Map Shared drive ***
net use K: \\FILESERVER\Shared
if errorlevel 1 set LS_Error=%LS_Error% K (SHARED)
if not exist i:\notes\desktop5.dsk goto skipnotes
Echo *** Copying Notes Desktop5.DSK to hard drive ***
copy i:\notes\desktop5.dsk c:\notes\data
:skipnotes
echo *** Configure Screen Saver ***
regedit -s \\fileserver\policies\screensaver.reg
goto checkerror
:checkerror
if "%LS_Error%"=="" goto end
echo.
echo ****************
echo * Login Script *
echo ****************
echo.
echo User: %USERNAME%
echo.
echo There has been a problem mapping drives to the servers.
echo.
echo Please place a helpdesk call or contact I.T. support stating the error below:
echo.
echo.
if "%LS_NoName%"=="True" echo Unable to map home drives as username is not set
echo Error with %LS_Error%
echo.
pause