Page 1 of 1 1
Topic Options
#132062 - 2005-01-07 07:42 PM Login found wrong server
Bigiron Offline
Fresh Scripter

Registered: 2004-12-15
Posts: 8
OK... you guys helped me out a month or so ago and did such a fantastic job... I can't thank you enough. BUT I find myself in a quandrum once again... and need the advice of the experts...

What I have is.. 3 schools I have active directory replicating with a wireless conection... the following login script worked to log them into the local server and worked just fine until I added a mail server at one site.

Now at this site the users are loging into the wrong server.. or they're losing drives that are mapped ??? The issue (I think) is the mail server is named IM and the main server is named MS-SRV.. and it's finding IM first and screwing things up.

Could anyone steer me in the right direction on this issue???

Here is the script I am using now...


@lserver

use list
USE G: /d
USE H: /d
USE G: "@lserver\apps"
USE H: "@lserver\@userid$$"
if ingroup("cs-office")
use I: "@lserver\common$$"
endif
if ingroup("ws-office")
use I: "@lserver\common$$"
endif
if ingroup("ms-office")
use I: "@lserver\common$$"
endif
if ingroup("ms-students")
use I: "@lserver\classes$$"
endif
if @userid = "smcmorris"
use I: "@lserver\classes$$"
endif

Top
#132063 - 2005-01-07 07:53 PM Re: Login found wrong server
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Is your mail server a domain controller?
Top
#132064 - 2005-01-07 07:55 PM Re: Login found wrong server
Bigiron Offline
Fresh Scripter

Registered: 2004-12-15
Posts: 8
Yes it is a domain controler
Top
#132065 - 2005-01-07 08:02 PM Re: Login found wrong server
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Instead of using @LServer directly, check it and cast it to a var.

Also, don't use vars inside strings.

Code:
If @Lserver <> 'IM'
$LServer = @LServer
Else
$LServer = 'the right server at this site'
EndIf
...
use I: $LServer+'\common$$'


Insead of all those separate InGroup() statements that all map to the same place, put them all in one.

If InGroup('cs-office','ws-office','ms-office')

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#132066 - 2005-01-07 08:10 PM Re: Login found wrong server
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
That is where I was going with my line of questioning.
Top
#132067 - 2005-01-07 10:07 PM Re: Login found wrong server
Bigiron Offline
Fresh Scripter

Registered: 2004-12-15
Posts: 8
The reason the ingroup statment is there is because each server has shares local to the school. The MS-SRV has a common share... the WS-SRV has a common share and the WS-SRV has a common share (among others)... they all have different data and different users...

So they don't accually log in to the same place. In fact that is why those statments are in there at all.

So I need the MS-SRV users to be able to log into the MS-SRV shares and the WS-SRV users to WS-SRV shares and the CS-SRV users to the CS-SRV shares.

The teachers move from school to school and log into local resorces...

The wireless connection is to slow to allow keeping everything at one site.

So what I need is.... If I am a teacher at MS-SRV I need to tell the difference between MS-SRV and IM to log into the correct server... THEN.. if I go over to WS-SRV I need to log into the WS-SRV because I need access to the students at this site.

Everything was working until I added the mail server at the MS-SRV site.

Top
#132068 - 2005-01-07 10:28 PM Re: Login found wrong server
Bigiron Offline
Fresh Scripter

Registered: 2004-12-15
Posts: 8
Is this what you folks mean???

@lserver

use list
USE G: /d
USE H: /d
USE G: "@lserver\apps"
USE H: "@lserver\@userid$$"

if ingroup('cs-office','ws-office')
use I: "@lserver\common$$"
endif

if ingroup("ms-office")

If @Lserver <> 'IM'
$LServer = @LServer
Else $LServer = 'MS-SRV'
EndIf...

use I: $LServer+'\common$$'
Endif

if ingroup("ms-students")

If @Lserver <> 'IM'
$LServer = @LServer
Else $LServer = 'MS-SRV'
EndIf...

use I: $lserver+'\classes$$'
endif

if @userid = "smcmorris"

If @Lserver <> 'IM'
$LServer = @LServer
Else $LServer = 'MS-SRV'
EndIf...

use I: $lserver+'\classes$$'
endif



Top
#132069 - 2005-01-07 10:54 PM Re: Login found wrong server
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Your arguement makes no sense. Regardless which "office" group you test for, the USE command is still the same so you could combine it just like I showed.

You still don't have the code right and are still using @LServer in your G: and H: mappings. You need to put the IF construct at the top and only need to use it once, not several times.

untested Code:
@lserver

If @LServer <> '\\IM'
$LServer = @LServer
Else
$LServer = '\\MS-SRV'
EndIf
use list
USE G: /d
USE H: /d
USE G: $LServer+'\apps'
USE H: $LServer+'\'+@UserID+'$$'
If InGroup('cs-office','ws-office','ms-office')
use I: $LServer+'\common$$'
endif
if ingroup("ms-students")
use I: $LServer+'\classes$$'
endif
if @userid = "smcmorris"
use I: $LServer+'\classes$$'
endif



Edited by Les (2005-01-07 10:56 PM)
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#132070 - 2005-01-07 11:29 PM Re: Login found wrong server
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Ja, what is happening is that since your mail server is a DC it is naturally authenticating users. Since that is the authenticating server the @LServer macro is pointing to the mail server, thus messing up your drive mappings.

@LServer = 'Whatever server authenicated you'

Top
#132071 - 2005-01-08 10:44 PM Re: Login found wrong server
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
So just altering the script to map the drive to xx-SRV (depending on the location the user is currently located) instead of mapping to @lserver would solve this problem.
The mailserver will still authenticate users (like chris said this is natural because it is a domain controler) but the drives will be mapped correctly to the server containing the data.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#132072 - 2005-01-08 10:50 PM Re: Login found wrong server
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
To be honest, I just cooked up a cheap and dirty workaround. One should never use @LServer to determine what drives to map. There is always the possibility that a DC other than the home DC will authenticate and screw things up.

The proper way would be to look at the @Site or IP subnet to determine the true "home".
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#132073 - 2005-01-13 09:59 PM Re: Login found wrong server
Anonymous
Unregistered


Now.. again I have to say I'm a beginner... What's easy for you guys, takes me days to figure out.. and then by trial and error and the code looks like crap...

What would the @site argument look like??? I am adding another domain controller at another school and that will need more arguments to log to the right server.

Thanks for all the help...

Top
#132074 - 2005-01-13 10:31 PM Re: Login found wrong server
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
If you have windows 2000 clients in an Active Directory domain, then you can configure Microsoft SITES in AD. The "@SITE" macro returns the name of the site in which the computer resides. You will need to read about and understand how to configure sites in AD. If you do configure sites. then you can use a simple:
Code:

Select
Case @site = "Site1" $servername = "Somename"
Case @site = "Site2" $servername = "ADifferentName"
Case 1 ? "site not matched"
Endselect

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#132075 - 2005-01-14 12:09 AM Re: Login found wrong server
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Just a little info on how to create AD sites. Just did it myself and working great.

To avoid long lines the url's are not directly posted.
If the links dont work just do a search at the MS site and search for create sites.

Link 1 to MS

Link 2 to MS

Been working with AD and sites on Win2K3 for about a month now and just like Shawn (I think it was Shawn) once said it's like HKEY_CURRENT_EVERYTHING.


Edited by R2D2 (2005-01-14 12:10 AM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 271 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.065 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org