[Samba] A (maybe)_ easy solution to global login script for group checking

RRuegner robert at ruegner.org
Sun May 23 09:35:44 GMT 2004


Amadeus schrieb:
> Hello
> 
> While searching the archives and googling for :
> 
> -login script to map drives according to group membership
> 
> I saw lots of complicated solutions (on-the-fly scripts, group directories) 
> etc. but the following works very well for me:
> 
> I downloade dthe ifmember.exe from the microsoft website, and stuck it in 
> the netlogon directory (not the scripts directory)
> 
> http://www.microsoft.com/windows2000/techinfo/reskit/tools/new/ifmember-o.asp
> 
> Then the script is:
> 
> @echo off
> 
> ifmember "DOMAIN\group1"
> 
> if not errorlevel 1 goto group2
> 
> net use r: \\SERVER\group1files
> 
> 
> :group2
> ifmember "DOMAIN\group2"
> 
> if not errorlevel 1 goto group3
> 
> net use s: \\SERVER\group2files
> 
> :group3
> 
> ....
> 
> So according toi group the network drives get mapped. It's all in one login 
> script and makes things easy!
> 
> I couldn't find this in the archives so I thought I'd share this.
> 
> What's nice is that you have the ifmember only on the server.
> 
> Hope it's not just repeating something I missed somewhere,
> 
> Amadeus
> 
Hi,
I use something like this as default.bat for every user
the other bat files which are called must be either exist or created by 
root preexec at the netlogonshare by netlogon.pl ( included in the smb 
examples but must be modified to use this bat default ) on the fly

  @echo off
  REM default login script robowarp at gmx.de for bdc1tk
  REM  this script is only valid for win2000/NT/XP
  REM sync time
  net time \\pdc /set /yes
  REM 
---------------------------------------------------------------------------------
REM exec bat for logged in machine ( maybe software status or machine data )
  echo %COMPUTERNAME%
call %COMPUTERNAME%.bat
REM 
-----------------------------------------------------------------------------------------------
rem exec bat for login user
echo %USERNAME%
call %USERNAME%.bat
REM 
---------------------------------------------------------------------------------------------
REM exec bat for different groups
REM ifmember.exe must be in the netlogon share download it at microschrott
REM be aware that ifmember will give result in the current win language
REM unlike normal dos, positive result from ifmember will match in 
errorlevel 1
ifmember /v /l "KOESLING\Domain Users"
if errorlevel 1 call domainusers.bat
ifmember /v /l "KOESLING\Domain Admins"
if errorlevel 1 call domainadmin.bat
ifmember /v /l "KOESLING\rdusers"
if errorlevel 1 call rdusers.bat
ifmember /v /l "KOESLING\tkusers"
if errorlevel 1 call tkusers.bat

Best Regards


More information about the samba mailing list