[Samba] Running a login script
Dennis McLeod
dmcleod at foranyauto.com
Wed Mar 19 15:12:58 GMT 2008
You can run it from anywhere, BUT, you'd have to have the drive mapped first
if it's on a network share.
You MAY be able to do a //server/share/logonscript.bat (I flipped the
slashes on purpose...), but I haven't tried that.
I copy a simple script (I have THAT as part of my logon script, too. Copy a
new one if it's different. Robocopy) to the local machine, and that one
launches the logon script from the server.
My local script looks like:
@echo off
net use q: \\server\login SECRETPASSWORD /user:login /persistent:no > NUL
CALL q:\logon.bat > NUL
Then my REAL logon script is the q:\logon.bat
I used gpedit to point the machine at the local batch file.
I have a registry string (For XP) to make the gpedit part easy:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts]
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logoff
]
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logoff
\0]
"GPO-ID"="LocalGPO"
"SOM-ID"="Local"
"FileSysPath"="C:\\WINDOWS\\System32\\GroupPolicy\\User"
"DisplayName"="Local Group Policy"
"GPOName"="Local Group Policy"
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logoff
\0\0]
"Script"="logoff.bat"
"Parameters"=""
"ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logon]
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logon\
0]
"GPO-ID"="LocalGPO"
"SOM-ID"="Local"
"FileSysPath"="C:\\WINDOWS\\System32\\GroupPolicy\\User"
"DisplayName"="Local Group Policy"
"GPOName"="Local Group Policy"
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logon\
0\0]
"Script"="logonscript.bat"
"Parameters"=""
"ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Save that as a .reg file, and you can double click it to merge the file.
(Notice there is a logoff script in there too......)
I put THAT in my (server) logon script too, and ran the logon script the
first time remotely, with psexec:
"C:\Documents and Settings\Admin\Desktop\PsTools\psexec.exe" @machines.txt
-u administrator -p SECRETPASSWORD -c logon.bat >> c:\psexec\results.txt
The machines.txt file is the list of machines I want it to run on.
You must know the (or another account with admin privileges) administrator
account password....
Hope that helps...
I tested this manually on a few machines first, before I ran it on the
rest......
Dennis
-----Original Message-----
From: samba-bounces+dmcleod=foranyauto.com at lists.samba.org
[mailto:samba-bounces+dmcleod=foranyauto.com at lists.samba.org] On Behalf Of
Mike Stewart
Sent: Wednesday, March 19, 2008 3:02 AM
To: Jean-Jacques Moulis
Cc: samba at lists.samba.org
Subject: Re: [Samba] Running a login script
Hi JJ, thanks for the response.
Does this mean we create and store a script on the Windows PC ?
We actually want to automatically run a script which resides on the Samba
server - once the user has logged in we want to automatically to map drives
etc.
Regards
Mike
----- Original Message -----
From: "Jean-Jacques Moulis" <jj at isy.liu.se>
To: "Mike Stewart" <mike at powys-training.co.uk>, samba at lists.samba.org
Sent: 19 March 2008 07:06:32 o'clock (GMT) Europe/London
Subject: Re: [Samba] Running a login script
On Tue, 18 Mar 2008 11:46:58 +0000 (GMT) Mike Stewart
<mike at powys-training.co.uk> wrote:
MS> Hello all,
MS> We are trying to find a way to run login scripts for our users but
MS> all the How-To files seem rather complicated :-(
MS> We have been using Samba for several years and all our users have
Windows 2000 PCs, Samba accounts etc. They log into their Windows with a
username/password OK. The Samba server is set up with the same
username/password combination as their PCs so they don't have to supply
username/password again and drive mappings are saved by Windows. A very
simple system which has proved easy to maintain.
MS> We are trying now to introduce "Generic" PCs which any user can access
(hot desking I think it is called). So, we want the Samba server to prompt
the user for a username/password combination when they click on the desktop
shortcut to the server (we've accomplished that part easily) and then
automatically run a login script to map their drives - that's the part we
are struggling to find a solution to.
MS> All the examples we've found so far refer to "Domain Controllers" - Do
we have to set up the server as a Domain controller, do we have to create
machines accounts etc ?
A domain controller would be my prefered solution.
But you can use login scripts without.
Run gpedit.msc on computers needing the login script.
Local computer policy --> user configuration --> windows settings -->
scripts --> logon --> add define the location of your script.
Regards!
--
Jean-Jacques Moulis Tel: (013) 281684
ISY Fax: (013) 139282
Linköping University E-mail: jj at isy.liu.se
581 83 Linköping
-----------------------------------------
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/listinfo/samba
More information about the samba
mailing list