RE: [Samba] Several logon script bat files?

2004-02-01 Thread Robert Sossomon
Here's how you do it:

everyone.bat
---
net use T: \\bo\Group
del C:\progra~1\netterm\netterm.ini
copy M:\netterm\netterm.ini C:\progra~1\netterm

CALL \\bo\netlogon\comms
CALL \\linux1\assets\clientcon.exe

Group.bat
---
net use G: \\bo\it
net use I: \\Linux1\Intranet
net use Q: \\Linux1\Qa
net use R: \\Linux1\Beta
net use X: \\Linux1\GCN_Extranet
net use P: \\bo\programs

Personal.bat

CALL \\bo\netlogon\clear

net use M: \\bo\robert

call \\bo\netlogon\it
call \\bo\netlogon\web

call \\bo\netlogon\everyone

--
CALL calls another batch file

Personal.bat first clears out the mapped drives (on all but 2K/XP
systems, haven't figured out why yet) then it maps the current user's
drive.  As I have a login for EACH user, this is the easy way to do it.
I then call their group specific batch file, then the everyone file.  I
use the group specific batch files to run the gambit of choices, and
just add a line to call that group file into each user's batch file.
Then when I need to modify something for a single group or for everyone
I just edit that one batch script.

Once all that editing is done, I run this script:
Run.sh

unix2dos *.bat
chmod +rx *.bat

Which makes all the files convert to the right format (I do the editing
on the linux box itself) and then make the scripts usable by the users
and servers.

Robert

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  http://lists.samba.org/mailman/listinfo/samba


Re: [Samba] Several logon script bat files?

2004-02-01 Thread rruegner
hi , i did it like this
[netlogon]
sharemodes= No
rootpreexec   = /var/lib/samba/netlogon/login.pl %U %G
%m %L
comment   = Netlogon Share
browseable= No
path  = /var/lib/samba/netlogon
guestok   = Yes
writelist = @ntadmin
locking   = no
public= no
cscpolicy = disable


#!/usr/bin/perl
#
# login.pl
# User $ARGV[0], Group $ARGV[1], client machine $ARGV[2], server $ARGV[3]
# creation on the fly logon scripts by [EMAIL PROTECTED] inspired by
genlogon.pl
# Log client connection
#($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
open LOG, /smbmonitor/user/netlogon.txt;
print LOG $mon/$mday/$year $hour:$min:$sec - User $ARGV[0] Group $ARGV[1]\n
from $ARGV[2] in $ARGV[3];
close LOG;

# Start generating logon script for user
open LOGON, /var/lib/samba/netlogon/$ARGV[0].bat;
print LOGON [EMAIL PROTECTED] OFF\r\n echo %USERNAME%\r\n call send.bat\r\n;

# Start generating logon script for machine for different security
monitoring
open LOGON, /var/lib/samba/netlogon/$ARGV[2].bat;
print LOGON [EMAIL PROTECTED] OFF\r\n call chkdir.bat\r\n call listapp.bat 
$ARGV[3]\\smbmonitor\\machines\\$ARGV[2]\\software\\$A$

# Start generating logon script for group
open LOGON, /var/lib/samba/netlogon/$ARGV[1].bat;
print LOGON [EMAIL PROTECTED] OFF\r\n;

# Connect shares for group users
if ($ARGV[1] eq users)
{
print LOGON NET USE X: $ARGV[3]\\files\r\n;
}

# Connect shares for group ntadmin
if ($ARGV[1] eq ntadmin)
{
print LOGON NET USE Y: $ARGV[3]\\smbmonitor\r\n;
}

logonscript   = login.bat

login.bat
@echo off
net time \\files /set /yes
rem by [EMAIL PROTECTED] leave to public as it is , dont think of asking me
rem  created for samba 3 login, the bat files were creted on the fly by
rem genlogin.pl
rem  this script is only valid for win2000/NT/XP
rem exec bat for logged in machine ( maybe software status or machine data )
echo %COMPUTERNAME%
call %COMPUTERNAME%.bat
rem exec bat for login user
echo %USERNAME%
call %USERNAME%.bat
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 MUSI\Domain Users
if errorlevel 1 call users.bat
ifmember /v /l MUSI\Domain Admins
if errorlevel 1 call ntadmin.bat
ifmember /v /l MUSI\kids
if errorlevel 1 call kids.bat

i advice you to study
genlogin.pl in the smb source
on ms technet load down ifmember.exe
and final sec policies are a good combination with this scripts

for a log of installed software you can use this
@echo off
regedit /a %TEMP%\filename.reg
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
for /f Skip=1 Tokens=* %%i in ('type %TEMP%\Filename.reg') do set
line=%%icall :parse
goto :EOF
:parse
set work=%line:~2,11%
set work=%work:=%
If NOT %work% EQU DisplayName goto :EOF
set work=%line:~16,120%
set work=%work:=%
@echo %work%

psinfo ( load down at pstools)


PsInfo 1.34 - local and remote system information viewer
Copyright (C) 2001-2002 Mark Russinovich
Sysinternals - www.sysinternals.com

Querying information for BUERO...^M
^MSystem inf$
Uptime:Error reading uptime
Kernel version:Microsoft Windows 2000, Uniprocessor Free
Product type:  Professional
Product version:   5.0
Service pack:  4
Kernel build number:   2195
Registered organization:   musi
Registered owner:  musi
Install date:  13.11.2003, 14:31:32
IE version:6.
System root:   C:\WINNT
Processors:1
Processor speed:   865 MHz
Processor type:Intel Pentium III
Physical memory:   640 MB
Volume Type   Format Label  Size   Free
Free
A: Removable
0%
C: Fixed  NTFS   38.2 GB33.7 GB
88%
D: CD-ROM
0%
E: CD-ROM
0%
Z: Remote NTFS   root 9.1 GB 6.1 GB
67%
OS Hot FixInstalled
KB329115  13.11.2003
KB820888  13.11.2003
KB822831  13.11.2003
KB823182  13.11.2003
KB823559  13.11.2003
KB824105  13.11.2003
KB824141  13.11.2003
KB824146  13.11.2003
KB825119  13.11.2003
KB826232  13.11.2003
KB828035  13.11.2003
KB828749  13.11.2003

also
this will produce monitor files like this

from buero in files0/29/104 14:53:40 - User lothar Group users
 from buero in files0/29/104 16:4:30 - User kind Group users
 from herren in files0/29/104 16:13:39 - User team Group users
 from buero in files0/30/104 11:30:11 - User team Group