Koozali.org: home of the SME Server

Loginscript Help

Graham

Loginscript Help
« on: March 15, 2002, 12:16:00 PM »
Hi,

Can anyone help me get win login script working ?

I was running SME 5.0.x until the other day.

On 5.0.x I installed e-smith-loginscript-0.1-1.noarch.rpm
which initially complained about another script package
so I removed that first and installed above with the result
of a nice control panel applet that I could enter a script into
following the examples :)' This worked for win clients fine.

Now that I installed 5.1.2 I tried same thing I also got a
complaint about another package conflict but not
.script-something but samba-something.

Anyways I used the --force option (was this dumb!) with
result that I cannot acces the server manager from
client nor console broswer. (No authority etc)

Before I tried the --force I tried writing the same script
that worked above into /home/netlogon/netlogon.bat but it
didnt work ?

Is there a new loginscript applet that works with 5.1.2 ?

Obvisouly I can follow instructions and know a little about
Linux BUT am very much still a beginner.

Any help would be appreciated !

Thanks !

Graham

ps If I should be posting elsewhere please let me know !
pps Is there some way to download bulk posts as I have found
them to be the most valuable source of answers / info !

Its brilliant that people want to help !

Dan G.

Re: Loginscript Help
« Reply #1 on: March 15, 2002, 06:30:13 PM »
I'd suggest you 'rpm -e' the login script package, then re-run the configuration "wizard" by logging in as admin, and confirming everthing.  See if that gets you back to your web console, and we can go from there.

Dan

Graham

Re: Loginscript Help
« Reply #2 on: March 15, 2002, 07:59:59 PM »
Thanks for prompt reply Dan.

I re-installed 5.1.2 (only 15 mins) and started again.

I realise now that in actual fact the only thing
you need to modify is the /home/netlogon/ntelogon.bat

I was editting under Linux so when I looked at it under DOS
it had some strange black blocks in it !!!

So I guess I dont really need the wizard / control panel thing
any more.

My Netlogon look like this :-

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@echo off

NET TIME \server /set /yes

NET USE H: /home

# ifg mdcgroup
NET USE S: \server\codata
# endif

regedit  /s \server\netlogon\officesavepaths.reg
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It all works apart from the HOME directory ?

This was in the sample and I notice it uses Unix /
as apposed to UNC \

How can I get this working so the clients have H:
drive that is their own folder ?


Many Thanks !

Dan G.

Re: Loginscript Help
« Reply #3 on: March 15, 2002, 08:13:26 PM »
Try enabling Roaming Profiles in Workgroup Settings, and see if that sorts it out.

Dan

Graham

Re: Loginscript Help
« Reply #4 on: March 15, 2002, 08:37:25 PM »
Dan,

I didnt have roaming profiles option before - in fact I dont even think its in
the 5.0.x releases.

What I need to do is whatever the login-script.rpm does to enable the home
directory mapping.

Its possibly just some short syntax included in the login.bat. . .

Thanks for your help though !

Devlyn Davis

Re: Loginscript Help
« Reply #5 on: March 15, 2002, 10:06:39 PM »
I haven't played with this yet myself, but reading the description for e-smith-loginscript says "Not to be installed with e-smith-netlogon."  Is it possible you would have to uninstall e-smith-netlogon before installing loginscript?

I will play with this this weekend because I too am having problems with mapping the 'home' directory.  I get an error that says 'Home directory is not defined.'


-Dev

Graham

Re: Loginscript Help
« Reply #6 on: March 15, 2002, 10:56:47 PM »
Hi,

You are right, there is a confilct betweeen those two packages.

My first attempt told me the files in conflict and I removed one
before installing the other.

The control panel version had a nice little list the let you pick the
users home drive mapping which worked a treat.

This obviously made some alteration to some conf file somehwere
(guesssing wildly)

Any rate I have discovered that just editting the netlogon.bat
correctly aleviates the need for any package installation.

Heres my netlogon.bat if its any help :-

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@echo off

NET TIME \server /set /yes

NET USE H: /home

# ifg mdcgroup
NET USE S: \server\codata
# endif

regedit /s \server\netlogon\officesavepaths.reg

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The only thing that doesnt work for me now is
the H: = Users Home Directory . . . .

Graham

Re: Loginscript Help
« Reply #7 on: March 15, 2002, 11:35:48 PM »
I was wrong . . .

The #ifg test doesnt work in that batch file either . . .

NET USE complains about /HOME

Not sure why becasue its just how it says to use it in the help !

Mmm . . . wonder what raoing profiles do . . .

More reading needed I guess !

Graham

Re: Loginscript Help
« Reply #8 on: March 16, 2002, 01:11:31 AM »
Hi Again,

For those who had trouble with this :-

I read the Samba Doc (/usr/share/doc)

There is a section about NT/9x Clients

In etc/smb.conf there is a section [global]

and two parameters :-

Set them to this

logon home = \%L\%U\.profiles (Thats dot profiles BTW)
logon path = \%L\profiles\%U

Seems to have done the trick !

Thanks to anyone who contributed . . .

OK My last question on this . . .

In the panel applet there where some tests
(# ifg etc) Is it possible to use these somehwere ?

Thanks !

Funny though about those .conf files that tell you to
go and edit the templates and then you go to the template
folder and there isnt one ?

tibor

Re: Loginscript Help
« Reply #9 on: March 16, 2002, 02:57:16 AM »
I also had problems to get "NET USE H: /home" in my netlogon.bat working. I had to enable the roaming profiles. Doing this my NT/2000 machines logons became slower (loading the profile I believe). I got around this modifying smb.conf.

I created a custom template fragment /etc/e-smith/templates-custom/etc/smb.conf/11logonhome
It looks like this:

{
# users logon home path
# %L substitutes for this logon servers name
# %U is username

    return "" unless ($SambaDomainMaster eq "yes");

    "logon home = \%L\%U\._winprofiles";

}

Now I do not need to use roaming profiles and NET USE H: /home maps users home directories OK.

T.

Ray Mitchell

Re: Loginscript Help
« Reply #10 on: March 16, 2002, 12:11:30 PM »
netlogn.bat works fine for me with home folder mapped, time set and drives and printers setup in 4.1.2 and 5.1.2 (skipped v5) without the need for additional scripting programs etc
Set the sme to be domain controller and enable roaming profiles (in 5.1.2 was not in 4.1.2).
On a windows workstation edit/create the netlogon.bat file in Windows Notepad NOT Linux text editor (puts in incompatible carriage returns), and copy to the logged on users home folder eg \server1\user1. Then logon to server1 as root (using Putty) and copy the file from the users home folder to /home/netlogon folder. If you want to make changes later then do the reverse remembering to edit and save in Windows.
Enable domain logon in your windows workstations and next time you log on the script will run.
eg below (2 servers, 3 printers) nothing fancy (server1=sme, server=Win2000)
net use F: \server1\cd-floppy
net use J: \server\cd
net use L: \server1\l
net use M: \server1\m
net use N: \server\n
net use W: \server\w
net use X: \server\x
net use Z: /home
net use \server1\hplaser1
net use \server1\hplaser2
net use \server\epson1
net time \server1 /set /yes

Hope this helps
Regards
Ray Mitchell

Devlyn Davis

Re: Loginscript Help
« Reply #11 on: March 16, 2002, 06:00:42 PM »
Ray, thanks for the examples.  I think, however, that the problem lies in that, for those who don't want to use roaming profiles, the '/home' directive does not work.  I used tibor's fix and it worked for me.  Roaming profiles are cool, but they can slowdown the login process, especially if the user has a bunch of data in his/her profile.

Thanks again,
-Dev

Devlyn Davis

Re: Loginscript Help
« Reply #12 on: March 17, 2002, 03:20:41 AM »
While searching for a way to create login scripts that would map drives according to group membership, I came across this site:

http://www.franken.de/users/lisa/horshack/winnt/loginwithoutkixtart.html

The only additional file required is: ingrp32.exe  I put it right in the netlogon volume with the netlogon.bat script.

The script is simple and effective.  It doesn't have the bells and whistles that kixstart does, but it is also a lot easier to grasp for those of us who are programming challenged.

-Dev

Devlyn Davis

Re: Loginscript Help
« Reply #13 on: March 17, 2002, 06:43:57 AM »
Looks like I may have spoken to soon.  The above utility works great for NT/2K, but does not work on 9x machines.  When running from Windows 98, it get the following error: "INGRP32.exe file s linked to missing export NETAPI32.DLLNetApiBufferFree."  After doing some research it looks like netapi32 might be an NT-only utility, at least in the way ingrp32 wants to use it.

If someone can find a work-around, please let me know.

Devlyn Davis

Re: Loginscript Help
« Reply #14 on: March 17, 2002, 07:37:57 AM »
OK, I think I FINALLY have it licked.  

ingrp32.exe works for NT/2000.
ifmember.exe  works for 9x.

I put both utilities in my netlogon volume and created the following script based on the one here:
http://www.franken.de/users/lisa/horshack/winnt/loginwithoutkixtart.html

Please review it and let me know if there is a more elegant (and simple) way of mapping drives based on group membership.  Thanks -Dev
 
=================Devlyn's current login script====================
@echo off

net time \beesmain2 /set /yes

net use g: /home /yes

if exist c:\boot.ini goto :NOT9X

rem ==== mapping drives for all users =========================================
set drive=q
set newshare=\beesmain2\fileshare
if not exist %drive%:\nul goto alle1
   net use %drive%: /delete
:alle1
net use %drive%: %newshare%


set drive=t
set newshare=\beesmain2\tmp
if not exist %drive%:\nul goto alle2
   net use %drive%: /delete
:alle2
net use %drive%: %newshare%


rem ===== mapping group drives===============================

set askgroup=gr_sales
set drive=M
set newshare=\beesmain2\vl_sales
%logonserver%\netlogon\ifmember.exe %askgroup%
if X%errorlevel%==X0 goto aftersales
@echo Your are member of group %askgroup%
net use q: /delete
net use q: %newshare%
:aftersales

set askgroup=gr_marketing
set drive=N
set newshare=\beesmain2\vl_marketing
%logonserver%\netlogon\ifmember.exe %askgroup%
if X%errorlevel%==X0 goto aftermarket
@echo Your are member of group %askgroup%
net use r: /delete
net use r: %newshare%
:aftermarket


net use z: /delete /yes
@exit


rem ======================= WINNT/2000 ================================
:NOT9X


rem ========= mapping drives for all users ==============================
set drive=q
set newshare=\beesmain2\fileshare
if not exist %drive%:\nul goto alle1
   net use %drive%: /delete
:alle1
net use %drive%: %newshare% /persistent:no


set drive=t
set newshare=\beesmain2\tmp
if not exist %drive%:\nul goto alle2
   net use %drive%: /delete
:alle2
net use %drive%: %newshare% /persistent:no


rem ============= mapping group drives============================

rem is user in the local group "Administrators"?
rem error 0 = not member
rem error 1 = member in global group
rem error 2 = member in local group
rem error 3 = API failure
rem


rem is the user in this group?
set askgroup=gr_sales
rem if yes, map this
set drive=M
rem with this share
set newshare=\beesmain2\vl_sales

ingrp32.exe %askgroup%
if not errorlevel 2 goto notingrp1
   echo %USERNAME% is member in group %askgroup%
   rem delete mapping if it exists yet
   if not exist %drive%:\nul goto connect1
      net use %drive%: /delete
:connect1
   net use %drive%: %newshare% /persistent:no
   goto allok1
:notingrp1
   echo %USERNAME% is NOT member in group %askgroup%
:allok1

rem is the user in this group?
set askgroup=gr_marketing
rem if yes, map this
set drive=N
rem with this share
set newshare=\beesmain2\vl_marketing

ingrp32.exe %askgroup%
if not errorlevel 2 goto notingrp2
   echo %USERNAME% is member in group %askgroup%
   rem delete mapping if it exists yet
   if not exist %drive%:\nul goto connect2
      net use %drive%: /delete
:connect2
   net use %drive%: %newshare% /persistent:no
   goto allok2
:notingrp2
   echo %USERNAME% is NOT member in group %askgroup%
:allok2

net use z: /delete /yes
@exit
==========================================================

Ray Mitchell

Re: Loginscript Help
« Reply #15 on: March 17, 2002, 04:36:48 PM »
If you don't want to use roaming profiles then don't set up Profiles on your Windows workstation. But you do need to enable the roaming profiles setting in sme to get netlogon.bat to work.

I do not have profiles set on my Win 95/98 & 2000 workstations and as mentioned before netlogon.bat works OK and sets up drives, maps home folder, printers, & sets time, without using any other script tools etc
Regards
Ray Mitchell

Devlyn Davis

Re: Loginscript Help
« Reply #16 on: March 17, 2002, 10:14:27 PM »
Ray Mitchell wrote:
>
> If you don't want to use roaming profiles then don't set up
> Profiles on your Windows workstation. But you do need to
> enable the roaming profiles setting in sme to get
> netlogon.bat to work.

I'm not sure that's entirely accurate.  I used Tibor's template fragment as noted above and I do not need to enable roaming profiles (at least I do not think this is the same as roaming profiles, certainly I did not enable roaming profiles from the admin page) to make the home drives work.  As a reminder here is the fragment:

{
# users logon home path
# %L substitutes for this logon servers name
# %U is username

return "" unless ($SambaDomainMaster eq "yes");

"logon home = \%L\%U\._winprofiles";

}

>
> I do not have profiles set on my Win 95/98 & 2000
> workstations and as mentioned before netlogon.bat works OK
> and sets up drives, maps home folder, printers, & sets time,
> without using any other script tools etc
> Regards
> Ray Mitchell

Using the above fragment, I was able to get netlogon.bat to work correctly with home drives (it even worked for mapping other drives and printers before I applied the fragment, just not home drives.)  However, I was not able to figure out how to map drives based on group membership.  With the two utilities I listed above, I am able to map drives based on group membership.  Do you have another way around this?

Thanks,
-Dev

Ben Morrisson

Re: Loginscript Help
« Reply #17 on: March 18, 2002, 05:21:44 AM »
if you don't want to use roaming profiles try this:

net use H: \[servername]\%username%

this presumes the SME account is the same you use for login to your machine
makes use of windows environment variable which seems logical as this is usually
the account/home drive you are after.

works with all versions

cheers.
Ben

Devlyn Davis

Re: Loginscript Help
« Reply #18 on: March 18, 2002, 06:59:34 AM »
Ben Morrisson wrote:
>
> if you don't want to use roaming profiles try this:
>
> net use H: \[servername]\%username%
>
> this presumes the SME account is the same you use for login
> to your machine
> makes use of windows environment variable which seems logical
> as this is usually
> the account/home drive you are after.
>
> works with all versions

Ok, that seems to work well and is much simpler than applying a custom fragment.  I'm sold.  Now, as far as mapping drives based on group membership, is there a more elegant or simpler method than the one I listed above?

Thanks for the great tips!
-Dev

Devlyn Davis

Re: Loginscript Help
« Reply #19 on: March 18, 2002, 10:45:36 PM »
Ben Morrisson wrote:
>
> if you don't want to use roaming profiles try this:
>
> net use H: \[servername]\%username%

I hate to keep beating this dead horse, but I'm having a problem with the above tip.  It works great in Windows 2000, but not in Windows 98.  I am back to using the fragment that tibor posted, which as been the most stable (non-roaming profile) setting across the different flavors of Windows.

Richard Emory

Re: Loginscript Help
« Reply #20 on: March 22, 2002, 10:42:41 PM »
This is what I used on a clients mixed 9X/2000/XP network.
Basically it works like this.  Filter the users out first, apply personal settings then jump to the group tag and do additional settings.

Hope this helps.
Richard Emory

@REM To set the time when clients logon to the domain:
@net time \limelight /set /yes

@rem Get which machine is logging on
@ECHO OFF
NET CONFIG | find "Computer">%TEMP%.\GETDATA.BAT
ECHO.e100'SET               COMPUTERNAME='>%TEMP%.\SCR
FOR %%C IN (w q) DO ECHO.%%C>>%TEMP%.\SCR
debug %TEMP%.\GETDATA.BAT<%TEMP%.\SCR>NUL
CALL %TEMP%.\GETDATA.BAT
deltree /y %TEMP%.\SCR %TEMP%.\GETDATA.BAT>NUL

@rem Get who is logging on
NET CONFIG | find "User">%TEMP%.\GETDATA.BAT
ECHO.e100'SET                   USERNAME='>%TEMP%.\SCR
FOR %%C IN (w q) DO ECHO.%%C>>%TEMP%.\SCR
debug %TEMP%.\GETDATA.BAT<%TEMP%.\SCR>NUL
CALL %TEMP%.\GETDATA.BAT
deltree /y %TEMP%.\SCR %TEMP%.\GETDATA.BAT>NUL

@rem Debug statements
@rem ECHO. Computer name is %COMPUTERNAME%
@rem ECHO. User name is %USERNAME%

@rem Decision tree on who is logging in
if "ADMIN"=="%USERNAME%" GOTO admin
if "ART"=="%USERNAME%" GOTO art
if "AYANNA"=="%USERNAME%" GOTO ayanna
if "BILL"=="%USERNAME%" GOTO bill
if "BRIDGETTE"=="%USERNAME%" GOTO bridgette
if "JACK"=="%USERNAME%" GOTO jack
if "JASON"=="%USERNAME%" GOTO jason
if "JREJR"=="%USERNAME%" GOTO jrejr
if "LARISA"=="%USERNAME%" GOTO larisa
if "NATHAN"=="%USERNAME%" GOTO nathan
if "PIERCE"=="%USERNAME%" GOTO pierce
if "USER"=="%USERNAME%" GOTO user

@rem Personalized settings
:admin
net use e: \lserv\netlogon
GOTO manager

:art
net use e: \lserv\art
GOTO eng

:ayanna
net use e: \lserv\ayanna
GOTO adm

:bill
net use e: \lserv\bill
GOTO cad

:bridgette
net use e: \lserv\bridgette
GOTO cad

:jack
net use e: \lserv\jack
GOTO adm

:jrejr
net use e: \lserv\jrejr
GOTO cad

:larisa
net use e: \lserv\larisa
GOTO cad

:nathan
net use e: \lserv\nathan
GOTO cad

:pierce
net use e: \lserv\pierce
GOTO cad

:user
net use e: \lserv\user
GOTO adm

:adm
net use f: \lserv\adminfiles
net use g: \lserv\confidential
net use h: \lserv\supervisor
if "JACK"=="%USERNAME%" GOTO eng
if "USER"=="%USERNAME%" GOTO eng
GOTO all

:eng
net use j: \lserv\engfiles
if "USER"=="%USERNAME%" GOTO cad
GOTO all

:cad
net use l: \lserv\dwg
net use u: \lserv\u-acad
net use s: \lserv\arch
GOTO all

:all
set USERNAME=
set COMPUTERNAME=
net use m: \lserv\netshare