[Samba] logon script
johnh at primebuchholz.com
johnh at primebuchholz.com
Wed Jun 3 19:06:46 GMT 2009
What about something like this in the logon script:
Dim objUser, objGroup, objGroupDict
Set objGroup = GetObject("WinNT://" & strDomain & "/" & strGroup &
Set objGroupDict = CreateObject("Scripting.Dictionary")
For Each objUser In objGroup.Members
objGroupDict.Add objUser.Name, "-"
IsMember = objGroupDict.Exists(strUserName)
Set objUser = Nothing
Set objGroup = Nothing
Set objGroupDict = Nothing
Liutauras Adomaitis <liutauras.adomaitis at gmail.com>
cr at rocon-it.de
samba at lists.samba.org, Santhosh Kumar Gulla <santy4linux at gmail.com>
06/03/2009 02:58 PM
Re: [Samba] logon script
On Mon, Jun 1, 2009 at 1:09 PM, Christian Rost <cr at rocon-it.de> wrote:
> you don't have access to Samba variables from within your logon script.
The most convenient way to solve this is by using the "ifmember.exe"
executable from the Windows Server 2003 toolkit and to place it into your
netlogon share - you need to google for ifmember.
> With ifmember.exe you can test, if the user who is running the logon
script, belongs to the specified group. Use the following lines as an
example and add it to your logon script:
> \\%SERVER01%\netlogon\ifmember.exe /verbose tech
> if errorlevel 1 goto TECH
> \\%SERVER01%\netlogon\ifmember.exe /verbose mktg
> if errorlevel 1 goto MKTG
> goto END
> ## TECH group
> if exist k:\nul net use /delete k: /yes
> if not exist k:\nul net use k: \\%SERVER01%\tech /persistent:no
> goto STOPTECH
> ## MKTG group
> if exist l:\nul net use /delete l: /yes
> if not exist l:\nul net use l: \\%SERVER01%\tech /persistent:no
> goto STOPMKTG
> rem This is the End of your script
I would suggest use ntlogon python script. Together with "root
preexec" and "root postexec" configuration options you can set up your
logon scripts to generated upon connecting to netlogon share.
I found this utility very useful and works very well. It supports
Mandriva ships this utility, so must other distributions.
There is problems with groups with spaces and capital letters, but it
is very easy to fix.
To unsubscribe from this list go to the following URL and read the
Please consider the environment before printing this e-mail.
This e-mail is intended only for the named person or entity to which it
is addressed and contains valuable business information that is
privileged, confidential and/or otherwise protected from disclosure.
Dissemination, distribution or copying of this e-mail or the information
herein by anyone other than the intended recipient, or an employee, or
agent responsible for delivering the message to the intended recipient,
is strictly prohibited. All contents are the copyright property of the
sender. If you are not the intended recipient, you are nevertheless
bound to respect the sender's worldwide legal rights. We require that
unintended recipients delete the e-mail and destroy all electronic
copies in their system, retaining no copies in any media. If you have
received this e-mail in error, please immediately notify us by calling
our Help Desk at (603) 433-1143, or e-mail to it at primebuchholz.com.
We appreciate your cooperation.
More information about the samba