[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:
Function IsMember(strGroup)
Dim objUser, objGroup, objGroupDict
Set objGroup = GetObject("WinNT://" & strDomain & "/" & strGroup &
",group")
Set objGroupDict = CreateObject("Scripting.Dictionary")
objGroupDict.RemoveAll
For Each objUser In objGroup.Members
objGroupDict.Add objUser.Name, "-"
Next
IsMember = objGroupDict.Exists(strUserName)
Set objUser = Nothing
Set objGroup = Nothing
Set objGroupDict = Nothing
End Function
-John
From:
Liutauras Adomaitis <liutauras.adomaitis at gmail.com>
To:
cr at rocon-it.de
Cc:
samba at lists.samba.org, Santhosh Kumar Gulla <santy4linux at gmail.com>
Date:
06/03/2009 02:58 PM
Subject:
Re: [Samba] logon script
On Mon, Jun 1, 2009 at 1:09 PM, Christian Rost <cr at rocon-it.de> wrote:
> Hi,
>
> 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:
>
> <....snip....>
> \\%SERVER01%\netlogon\ifmember.exe /verbose tech
> if errorlevel 1 goto TECH
> :STOPTECH
>
> \\%SERVER01%\netlogon\ifmember.exe /verbose mktg
> if errorlevel 1 goto MKTG
> :STOPMKTG
>
> goto END
>
> ##
> ## TECH group
> ##
> :TECH
> 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
> ##
> :MKTG
> if exist l:\nul net use /delete l: /yes
> if not exist l:\nul net use l: \\%SERVER01%\tech /persistent:no
> goto STOPMKTG
>
> :END
> rem This is the End of your script
>
> <...snip...>
>
> Cheers,
>
> Christian
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
samba variables.
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.
Liutauras
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
--
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
mailing list