Login script

Dan Egli ninja at enol.com
Tue Jun 27 01:10:01 GMT 2000


Sounds good. Thanks!

On Sun, 25 Jun 2000, Chris Watt wrote:

> At 03:16 PM 25/06/00 +1000, you wrote:
> 
> >If there is a script I can place somwehre, please tell me what it's name
> >is and where I can place it!
> 
> Various Windows flavors have varying degrees of support for logon scripts
> which might sometimes work. . . Personally I find that the easiest way to
> handle things is to reference a batch file from the RUN key in the windows
> registry along the lines of:
> 
> REGEDIT4
> 
> [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
> "Logon"="C:\\windows\\logon.pif"
> 
> Then logon.pif starts logon.bat with the run-minimized and close when done
> options set. Logon.bat consists of essentially:
> 
> --- CUT HERE --
> 
> net time \\smbserver /set /yes
> if errorlevel 1 goto error
> 
> net use * \\smbserver\logon /yes | choice /C:abcdefghijklmnopqrstuvwxyz >NUL:
> if errorlevel 0 set mappedrive=ERROR
> if errorlevel 1 set mappedrive=a
> if errorlevel 2 set mappedrive=b
> if errorlevel 3 set mappedrive=c
> if errorlevel 4 set mappedrive=d
> if errorlevel 5 set mappedrive=e
> if errorlevel 6 set mappedrive=f
> if errorlevel 7 set mappedrive=g
> if errorlevel 8 set mappedrive=h
> if errorlevel 9 set mappedrive=i
> if errorlevel 10 set mappedrive=j
> if errorlevel 11 set mappedrive=k
> if errorlevel 12 set mappedrive=l
> if errorlevel 13 set mappedrive=m
> if errorlevel 14 set mappedrive=n
> if errorlevel 15 set mappedrive=o
> if errorlevel 16 set mappedrive=p
> if errorlevel 17 set mappedrive=q
> if errorlevel 18 set mappedrive=r
> if errorlevel 19 set mappedrive=s
> if errorlevel 20 set mappedrive=t
> if errorlevel 21 set mappedrive=u
> if errorlevel 22 set mappedrive=v
> if errorlevel 23 set mappedrive=w
> if errorlevel 24 set mappedrive=x
> if errorlevel 25 set mappedrive=y
> if errorlevel 26 set mappedrive=z
> if errorlevel 27 set mappedrive=ERROR
> 
> if "%mappedrive%"=="ERROR" goto error
> 
> call %mappedrive%\logon.bat
> 
> net delete %mappedrive% /yes
> 
> goto end
> 
> :error
> echo Oops, it looks like your network is broken
> pause
> 
> :end
> --- CUT HERE --
> 
> The preceding maps a share called "logon" to any available drive letter,
> attempts to run a file called "logon.bat" located in that share (may be
> user/machine/time dependant by using samba's various magic file creation
> abilities) and then disconnects from the logon share. I've stripped out a
> lot of the ugly kludge code for my specific setup, so the above may be
> slightly broken in some way, but it should be possible to fix it easily
> enough if that is the case.
> The variation on this which I am using works fine in Windows9x, not sure
> about NT but it should work if it has the dos NET command.
> --
> 
> Irony: Bill Gates claims to be making a stable Operating System,
> and Linus Torvalds claims to be taking over the world.
> 
> 



More information about the samba mailing list