[Samba] Re: Solved ?: Help ! Logon script doesn't work on XP

M. Vancl mvancl at setuza.cz
Fri Apr 9 14:52:44 GMT 2004

"Paul Gienger" <pgienger at ae-solutions.com> wrote:
> The way logon scripts are 'supposed' to work is that you specify the
> script in your smb.conf file such as
> logon script = logon.bat
> and then you specify a netlogon share such as:
> [netlogon]
>         path = /opt/samba/share/netlogon
>         browseable = No

It was naturally done in my smb.conf.

> When you log on, the client automatically look in
> \\<servername>\netlogon for whatever script you specified.
> If you need more flexibility than that in your scripts, you can either
> do some scripting in the main batch file, or you can do do automatic
> generation of the script.  Here we specify that each user has their own
> logon script by saying:
> logon script = %U.bat

Yes it's usual. Little but important difference on my conf. is using %m
macro instead of  %U because script is generated on the fly and it is
theoretically possible to log on the same user on multiple workstations but
no several users on one workstation in the same time, so witm %m is
impossible to damage running script.

> and <username>.bat is generated in a script each time the user logs on.
> To have that script run, you add a "root preexec" parameter to the
> netlogon share:
> root preexec = /opt/samba/bin/prelogon.pl %U
> which will take the username as an argument, and create a script in the
> location of the netlogon share with that username as the filename.

My root preexec script have (for now) '%m' '%U' '%L' '%d' '%a' '%P'
parameters. Maybe some of them will not be useful.

Additionally I use, mainly due my ancient experience on speed of logon
script execution, technique of copying the main (= large) logon.bat script
from netlogon share to local disk and calling this copy. Reason was that
command.com on Win9x opened and closed and read whole logon script for every
executed line and it was on that ancient time very slow.

This is example of my script <client>.bat:
@echo off
set CLIENT=prog01t
set USER=p01861
set SERVER=sambaii
set SMBPID=8488
set ARCH=WinXP
copy /b \\sambaii\netlogon\logon.bat %TEMP%\logon.bat

... and logon.bat is significantly greater and complex.


M. Vancl

More information about the samba mailing list