This is a discussion on [Samba] login scripts --what to use within the Samba forums, part of the Networking and Network Related category; Hi, We're setting up a PDC, and would like to have a login script to deliver the mapped drives ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
We're setting up a PDC, and would like to have a login script to deliver the mapped drives to users in particular groups, and connect to printers. The printer drivers come from the [print$], share. Does anyone have any good resources for this? What's the easiest and simplest thing to get going --vbscript or batch files? Thanks, chris -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba |
|
|||
|
On Thu, 19 Jun 2008, Christopher Perry might have said:
> Hi, > We're setting up a PDC, and would like to have a login script to deliver > the mapped drives to users in particular groups, and connect to > printers. The printer drivers come from the [print$], share. > > Does anyone have any good resources for this? What's the easiest and > simplest thing to get going --vbscript or batch files? My logon script is: ------------------------ cat /etc/samba/netlogon/logon.bat @echo off rem match the server time net time \\timehost /set /yes net use H: \\elo\%USERNAME% net use P: \\cairo\pointwise net use S: \\elo\pointwise net use T: \\elo\tmp rem allow for per-user customization of the windows environment if exist h:\%USERNAME%.bat call h:\%USERNAME%.bat rem update the windows screen saver settings for security c:\windows\system32\cscript \\elo\netlogon\screen-saver.vbs ------------------------ Mike -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba |
|
|||
|
> -----Original Message-----
> From: samba-bounces+dmcleod=foranyauto.com@lists.samba.org > [mailto:samba-bounces+dmcleod=foranyauto.com@lists.samba.org] > On Behalf Of Christopher Perry > Sent: Thursday, June 19, 2008 7:14 AM > To: samba@lists.samba.org > Subject: [Samba] login scripts --what to use > > Hi, > We're setting up a PDC, and would like to have a login script > to deliver the mapped drives to users in particular groups, > and connect to printers. The printer drivers come from the > [print$], share. > > Does anyone have any good resources for this? What's the > easiest and simplest thing to get going --vbscript or batch files? > > Thanks, > chris I use bat files, because I'm not smart enough to figure out vbscript..... I'm posting this because I get a lot of help here, but rarely can help anyone. I am better at windows than *nix, but I'm trying to learn... There is MORE here than you asked for, but maybe someone else can use something. Please, don't tease..... Here's my logon script which calls a bunch of others. ---------------------------------------------------------------------------- ---------------------------------------------- logon.bat: @echo on set logondrive=\\server\netlogon\scripts set software=p:\software set logs=\\server\logs :start ECHO Login - %username% - %date% - %time% >> "%logs%\%computername%.txt" CALL %logondrive%\drives.bat CALL %logondrive%\O2K7fmt.bat CALL %logondrive%\pfbk.bat CALL %logondrive%\dns.bat CALL %logondrive%\filecopy.bat CALL %logondrive%\favorites.bat CALL %logondrive%\flash9.bat CALL %logondrive%\java.bat CALL %logondrive%\ar707.bat CALL %logondrive%\svg.bat CALL %logondrive%\ldap.bat Call %software%\mozilla\firefox\ffxupdate.bat CALL %logondrive%\stats.bat CALL %logondrive%\wsusupdate.bat cscript p:\printers.vbs :EOF ---------------------------------------------------------------------------- ---------------------------------------------- The "%logs% folder is writeable, but not readable. You can look at the folder (if you knew where), but it appears there is nothing in there. Only root can look at the files in there... There was a series of posts earlier this year on how to make one. ( http://lists.samba.org/archive/samba...il/139726.html ) I think that's the pertinent post. Drives.bat maps drives. O2K7fmt installs the Office 2007 file format converters... Pfbk.bat installs Microsoft's pst backup utility for Outlook. Dns.bat sets the DNS servers (From before we had DCHP set up) really can REM it out now.... Filecopy.bat does just that, plus does registry imports.... Favorites.bat copies a folder of important favorites to the users favorites folder. (I can go the other way to and collect everyones favorites.....It gets interesting sometimes....) Fast.bat robocopy's a network folder to a local folder for my parts department machines to run their parts catalog local. Flash9 install's flash9.... Java install's java 1.4 (version required for DMS.) LDAP.bat imports a prf file to set the ldap server for Outlook to use to resolve email addresses. (I'm not currently using LDAP for anything else. Kind of waiting on Samba 4....) AR707 installs Acrobat reader 7.07. (version required for DMS.) Svg.bat installs Adobe SVG reader. (required by service department program for looking at wiring diagrams.) Ffxupdate installs/updates firefox. For Sales Department, but I just let it install on all. Printers.vbs installs a certain printer. I really need to figure this out better. Stats.bat writes some machine information to a file. Wsusupdate sets the machine to get it's updates from my WSUS server. (it recently died, so I had to point them to the new server.) Some of these were written before I learned some things, so they are not all consistent. Setting and using the variables, for instance..... You could just use the logon.bat and drives.bat example to get the drives mapped. I need to work on my printers..... Here's the rest... (ifmember and robocopy from the W2K3 server resource kit) http://www.microsoft.com/DOWNLOADS/d...A69-57FF-4AE7- 96EE-B18C4790CFFD&displaylang=en ---------------------------------------------------------------------------- ---------------------------------------------- Drives.bat: @ECHO ON net time \\server /set /yes net use h: \\server\%username% /persistent:yes \\server\netlogon\ifmember "dominname\client" if not errorlevel 1 goto accts net use i: \\server\client :accts \\server\netlogon\ifmember "dominname\acctsdep" if not errorlevel 1 goto parts net use j: \\server\accounts :parts \\server\netlogon\ifmember "dominname\partsdept" if not errorlevel 1 goto service net use k: \\server\parts :service \\server\netlogon\ifmember "dominname\servicedept" if not errorlevel 1 goto sales net use s: \\server\service :sales \\server\netlogon\ifmember "dominname\salesdept" if not errorlevel 1 goto internet net use l: \\server\sales :internet \\server\netlogon\ifmember "dominname\internet" if not errorlevel 1 goto hr net use s: \\server\internet :hr \\server\netlogon\ifmember "dominname\hr" if not errorlevel 1 goto finance net use m: \\server\hr :finance \\server\netlogon\ifmember "dominname\finsrvcs" if not errorlevel 1 goto managers net use n: \\server\finance :managers \\server\netlogon\ifmember "dominname\Managers" if not errorlevel 1 goto public net use o: \\server\managers :public net use p: \\server\public /persistent:yes :EOF ---------------------------------------------------------------------------- ---------------------------------------------- O2K7fmt.bat: @ECHO ON if exist "%systemdrive%\Program Files\Microsoft Office\Office12\excelcnv.exe" GOTO EOF "%software%\office07compat\fileformatconverters.ex e" /passive /quiet /norestart :EOF ---------------------------------------------------------------------------- ---------------------------------------------- pfbk.bat: if EXIST "%systemdrive%\program files\microsoft office\office11\addins\outbak.dll" GOTO EOF :install start /wait %software%\pstbackup\pfbackup.exe /q :EOF ECHO "SKIPPED" ---------------------------------------------------------------------------- ---------------------------------------------- DNS.bat (was setting it manually using "set dns "Local Area Connection" xxx.xxx.xxx.xxx" and "add dns "Local Area Connection" xxx.xxx.xxx.xxx index=2") but now: @echo ON REM netsh interface ip set dns "Local Area Connection" dhcp ---------------------------------------------------------------------------- ---------------------------------------------- Filecopy.bat: @ECHO on xcopy %logondrive%\scripts "%systemroot%\system32\GroupPolicy\user\script s\" /s /e /I /v /c /y >NUL xcopy %logondrive%\scripts\logon\logon.bat %systemdrive%\egn\ /I /y >NUL xcopy %logondrive%\robocopy.exe %systemroot%\system32\ /Y >NUL xcopy %logondrive%\hosts %systemroot%\system32\drivers\etc /Y >NUL xcopy %logondrive%\lmhosts %systemroot%\system32\drivers\etc /Y >NUL xcopy "p:\templates" "%userprofile%\Application Data\Microsoft\Templates" /I /c /y >NUL REM regedit.exe /s %logondrive%\logonmessage.reg regedit.exe /s %logondrive%\wsus.reg regedit.exe /s %logondrive%\nosearch.reg regedit.exe /s %logondrive%\sharedoc.reg regedit.exe /s %logondrive%\defaultzone.reg regedit.exe /s %logondrive%\zones.reg regedit.exe /s %logondrive%\profile.reg :EOF ---------------------------------------------------------------------------- ---------------------------------------------- Favorites.bat: (need to change this to use the variables...) @ECHO on xcopy "%logondrive%\favorites\*.*" "%userprofile%\favorites\" /y >NUL :EOF ---------------------------------------------------------------------------- ---------------------------------------------- FLASH9.bat: (really old, need to re-look at. Stop using check file to determine if it needs to run.) @Echo on GOTO IE :IE IF EXIST "%systemdrive%\EGN\checks\flash9.chk" GOTO ffx msiexec /i %software%\Adobe\flash9.msi /q ECHO %TIME% - %DATE% >> "%systemdrive%\EGN\checks\flash9.chk" REM ECHO flashinstall - %TIME% - %DATE% >> "%logs%\%computername%.txt" :ffx if EXIST "%systemdrive%\egn\checks\ffxflash9.chk" GOTO EOF if NOT EXIST "%programfiles%\mozilla firefox\firefox.exe" GOTO EOF %software%\Adobe\flash9firefox.exe /silent ECHO %TIME% - %DATE% >> "%systemdrive%\EGN\checks\ffxflash9.chk" REM ECHO ffxflashinstall - %TIME% - %DATE% >> "%logs%\%computername%.txt" :EOF ---------------------------------------------------------------------------- ---------------------------------------------- Ldap.bat: (need to stop using check files....) @Echo on if EXIST "%systemdrive%\egn\checks\ldap.chk" GOTO EOF if NOT EXIST "%systemdrive%\Program Files\Microsoft Office\OFFICE11\outlook.exe" GOTO EOF "%systemdrive%\Program Files\Microsoft Office\OFFICE11\outlook.exe" /importprf "P:\software\ldap\ldap.prf" ECHO %TIME% - %DATE% >> "%systemdrive%\EGN\checks\ldap.chk" :EOF ---------------------------------------------------------------------------- ---------------------------------------------- Ffxupdate.bat: (this is a bit over my head, as I am really just a hack. I manage to make it work for this and other software, but all the for/find stuff I really need to learn better......) @Echo ON IF not exist "C:\Program Files\Mozilla Firefox" goto :EOF Setlocal Set CV="2.0.0.14 (en-US)" Set "key=HKLM\SOFTWARE\Mozilla\Mozilla Firefox" For /f "tokens=3* delims= " %%# In ( 'Reg query "%key%" /v CurrentVersion ^|Find "REG_" 3^>Nul') Do Set rel="%%#" If Not [%rel%]==[%CV%] Start "" /wait %software%\mozilla\firefox\ffx20014.exe -ms del "%allusersprofile%\desktop\Mozilla Firefox.lnk" Goto :Eof ---------------------------------------------------------------------------- ---------------------------------------------- stats.bat: (need to expand for greater coverage) ECHO on ECHO ****************************Logonscript Contents******************* >> "%logs%\%computername%.txt" type "c:\egn\logon.bat" >> "%logs%\%computername%.txt" ECHO ****************************END Logonscript Contents******************* >> "%logs%\%computername%.txt" ECHO . ECHO . ECHO **************Login User, Date, and Time************************* >> "%logs%\%computername%.txt" ECHO Login - %username% - %date% - %time% >> "%logs%\%computername%.txt" ECHO **************END Login Date and Time************************* >> "%logs%\%computername%.txt" ECHO . ECHO . ECHO **************IP INFORMATION************************* >> "%logs%\%computername%.txt" ipconfig /all >> "%logs%\%computername%.txt" ECHO **************END IP INFORMATION************************* >> "%logs%\%computername%.txt" ECHO . ECHO . ECHO **************Get IE Version************************* >> "%logs%\%computername%.txt" reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Interne t Explorer" /v Version >> "%logs%\%computername%.txt" ECHO **************END IE Version************************* >> "%logs%\%computername%.txt" ECHO . ECHO . ECHO **************Check for Websuite************************* >> "%logs%\%computername%.txt" if EXIST "%systemdrive%\Program Files\Adp\ws2000\ws2000.exe" ECHO ADP installed >> "%logs%\%computername%.txt" if NOT EXIST "%systemdrive%\Program Files\Adp\ws2000\ws2000.exe" ECHO ADP NOT installed >> "%logs%\%computername%.txt" Reg query "HKLM\SOFTWARE\ADP\wsvc" /v Version >> "%logs%\%computername%.txt" ECHO **************END Check for Websuite************************* >> "%logs%\%computername%.txt" ECHO. ECHO. ---------------------------------------------------------------------------- -------------------------- Printers.vbs: ' ' Printers.vbs - Windows Logon Script. Set objNetwork = CreateObject("WScript.Network") objNetwork.AddWindowsPrinterConnection "\\server\Dell3115" ---------------------------------------------------------------------------- ---------------------------------------------- WSUSUPDATE.bat: (used to change wsus servers recently.) @echo off Net Stop "wuauserv" rename "%SystemRoot%\Windowsupdate.log" "Windowsupdate.logold" Echo Importing WSUS.reg %windir%\Regedit.exe /s %logondrive%\WSUS.reg Echo WSUS.reg imported succesfully Net Start "wuauserv" Echo Forcing update detection wuauclt /detectnow Wsus.reg: (sets the wsus server) Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Win dows\WindowsUpdate] "WUServer"="http://xxx.xxx.xxx.xxx:8530" "WUStatusServer"="http://xxx.xxx.xxx.xxx:8530" [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Win dows\WindowsUpdate\AU] "NoAutoRebootWithLoggedOnUSers"=dword:00000001 "RescheduleWaitTime"=dword:0000001e "LastWaitTimeout"=dword:00000000 "DetectionStartTime"=dword:00000000 "UseWUServer"=dword:00000001 "NoAutoUpdate"=dword:00000000 "AUOptions"=dword:00000004 "ScheduledInstallDay"=dword:00000000 "ScheduledInstallTime"=dword:00000022 "DetectionFrequencyEnabled"=dword:00000001 "DetectionFrequency"=dword:00000016 ---------------------------------------------------------------------------- ---------------------------------------------- What I'd like to know is how to make a certain script run if the machine name is in a certain file. Put my parts department machinename in a parts.txt file, and then have the script check to see if it's there. (or perhaps some other way to accomplish this.....) I just haven't spent the time to look for this yet. Again, I hope this helps someone, and thanks to everyone on this list. And of course the Samba developers for Samba in the first place... Dennis -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba |
|
|||
|
> rem update the windows screen saver settings for security
> c:\windows\system32\cscript \\elo\netlogon\screen-saver.vbs Care to share your "screen-saver.vbs" Thanks, Dennis -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba |
|
|||
|
On Thursday 19 June 2008, Christopher Perry wrote:
> We're setting up a PDC, and would like to have a login script to > deliver the mapped drives to users in particular groups, and connect > to printers. The printer drivers come from the [print$], share. > > Does anyone have any good resources for this? What's the easiest and > simplest thing to get going --vbscript or batch files? I use a monolithic bat file that works, outside of installing printers in non-NT based systems. It could be simplified in at least two ways: 1 - if you have no need to support pre-NT based winboxen, and 2 - use a separate script for each user instead of the monolithic format (just been using it for years, even with NT PDC's). Example: ================================================== === @echo OFF @if not "%ECHO%"=="" echo %ECHO% set NETSW=/yes if "%OS%"=="Windows_NT" set NETSW=/persistent:no %NETSW% if exist l:*.* net use l: /delete net use l: \\server\library %NETSW% if exist p:*.* net use p: /delete net use p: \\server\projects %NETSW% rem acct shares if "%USERNAME%"=="dave" goto :ACCTSET if "%USERNAME%"=="frontdesk" goto :ACCTSET if "%USERNAME%"=="keith" goto :ACCTSET goto :ACCTSKIP :ACCTSET if exist w:*.* net use w: /delete net use w: \\server\ad2 %NETSW% if exist o:*.* net use o: /delete net use o: \\server\office %NETSW% :ACCTSKIP rem additional office shares if "%USERNAME%"=="buster" goto :OFFICESET if "%USERNAME%"=="george" goto :OFFICESET goto :OFFICESKIP :OFFICESET if exist o:*.* net use o: /delete net use o: \\server\office %NETSW% :OFFICESKIP rem acct shares if not "%OS%"=="Windows_NT" goto :PRT rundll32 printui.dll,PrintUIEntry /dn /n "\\server\Virtual_Printer" /q rundll32 printui.dll,PrintUIEntry /dn /n "\\server\konicaC450" /q rundll32 printui.dll,PrintUIEntry /dn /n "\\server\hpLaserJet" /q rundll32 printui.dll,PrintUIEntry /in /n "\\server\Virtual_Printer" /q rundll32 printui.dll,PrintUIEntry /in /n "\\server\konicaC450" /q rundll32 printui.dll,PrintUIEntry /in /n "\\server\hpLaserJet" /q if "%COMPUTERNAME%"=="COMP1" goto :DEFPRN if "%COMPUTERNAME%"=="COMP4" goto :DEFPRN if "%COMPUTERNAME%"=="COMP9" goto :DEFPRN if "%COMPUTERNAME%"=="COMP12" goto :DEFPRN2 if "%COMPUTERNAME%"=="COMP16" goto :DEFPRN2 goto :EOF :DEFPRN rundll32 printui.dll,PrintUIEntry /y /n "\\server\hpLaserJet" /q goto :EOF :DEFPRN2 rundll32 printui.dll,PrintUIEntry /dn /n "\\server\acctPrt" /q rundll32 printui.dll,PrintUIEntry /in /n "\\server\acctPrt" /q rundll32 printui.dll,PrintUIEntry /y /n "\\server\acctPrt" /q goto :EOF :PRT if exist h:*.* net use h: /delete net use h: \\server\%USERNAME% %NETSW% net time /set /yes if exist c:\windows\*.* echo . >c:\windows\lmscript.$$$ ================================================== === You'll notice that I delete shares/and printers before adding them. This takes a few extra seconds but prevents warnings/errors being raised when trying to map/connect to existing shares. Also if a user deletes a printer or share they simply have to logoff and logon to get it back. The "net time" command is not run for NT based systems as the users do have rights to set the time and the W32time service works continuously and better anyway. The h: drive is the "home" drive which gets set automagically in NT-based boxen but not in the others. -- Chris -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba |
|
|||
|
On Thursday 19 June 2008, Chris Smith wrote:
> The "net time" command is not run for NT based systems as the users > do have rights to set the time Sorry should read "...do NOT have rights..." -- Chris -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba |
|
|||
|
Dennis McLeod wrote:
>> -----Original Message----- >> From: samba-bounces+dmcleod=foranyauto.com@lists.samba.org >> [mailto:samba-bounces+dmcleod=foranyauto.com@lists.samba.org] >> On Behalf Of Christopher Perry >> Sent: Thursday, June 19, 2008 7:14 AM >> To: samba@lists.samba.org >> Subject: [Samba] login scripts --what to use >> >> Hi, >> We're setting up a PDC, and would like to have a login script >> to deliver the mapped drives to users in particular groups, >> and connect to printers. The printer drivers come from the >> [print$], share. >> >> Does anyone have any good resources for this? What's the >> easiest and simplest thing to get going --vbscript or batch files? >> .. . . chop . . . > ---------------------------------------------------------------------------- > ---------------------------------------------- > > What I'd like to know is how to make a certain script run if the machine > name is in a certain file. > Put my parts department machinename in a parts.txt file, and then have the > script check to see if it's there. (or perhaps some other way to accomplish > this.....) > I just haven't spent the time to look for this yet. > > > @echo off call :_DO_ALL_PCS echo Do more stuff on any PC goto :_END :: :: routines :: :_DO_ALL_PCS for /f "usebackq eol=c" %%C in (`type \\SERVER\netlogon\hosts.list`) do ( if "%COMPUTERNAME%" == "%%C" call :_DO_%COMPUTERNAME% ) goto :EOF :_DO_PC_01 echo Do stuff specific for PC_01 goto :EOF :_DO_PC_02 echo Do stuff specific for PC_02 echo Do more stuff specific for PC_02 goto :EOF :_END -- Toby Bluhm Alltech Medical Systems America, Inc. 30825 Aurora Road Suite 100 Solon Ohio 44139 440-424-2240 ext203 -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba |
|
|||
|
On Thu, Jun 19, 2008 at 10:13 AM, Christopher Perry
<cperry@hmdc.harvard.edu> wrote: > Hi, > We're setting up a PDC, and would like to have a login script to deliver the > mapped drives to users in particular groups, and connect to printers. The > printer drivers come from the [print$], share. > > Does anyone have any good resources for this? What's the easiest and > simplest thing to get going --vbscript or batch files? You might want to check out this thread: http://readlist.com/lists/lists.samb...a/4/24194.html You can dynamically generate .BAT files that do drive mappings based on group membership, you can run autoit, kixtart, or winbatch executables, load reg files, et cetera ad infinitum. --Charlie -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba |