Page 1 of 1 1
Topic Options
#21207 - 2002-05-04 03:39 PM Multiples sites and logon scripts - little advice please?
Anonymous
Unregistered


Hi All,

I have three sites, A, B, and C.

A is our mainsite with approx 500 9x/nt/2k PC's.

B&C are small remote sites with approx 25 PC's each, 90% NT/2k with 10% Win9x.

The two remotes are connected to mainsite over 256kbps leased lines.

We're in the process of merging the remote sites to be part of a single Windows 2000 domain.

The main site has four DCs, each remote site will also have a DC.

I'm looking for a way of making sure that whenever someone logs on they are running the various apps that the logon script calls locally from the site they're in rather than over the link (antivirus/audit software/software usage policy reminder etc..).

I can see of two ways of doing this:

Use the @lserver variable to call these programs from the site holding the validating server.

IF @LSERVER="B_PDC"
SHELL @LDRIVE + "\B_antivirus.bat"
ENDIF

This works on the principle that 90% of the time the first logon server to resond will be the local one.

Or use something I read about here, like

IF substr(@ipaddress)="10.65."
SHELL @LDRIVE + "\B_antivirus.bat"
ENDIF

I'd have thought the latter is the foolproof method as the the IP address must be on a different subnet for each site, so even if you logon against a remote server your IP address shows which site you're in.

As a final quickie, I assume "shell" is the command to use to call a batch file but wait for it to run before continuing?

I'd be extremely grateful for any advice or pointers!

rgds
Paul

[ 04 May 2002, 15:44: Message edited by: hutchingsp ]

Top
#21208 - 2002-05-04 03:59 PM Re: Multiples sites and logon scripts - little advice please?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Well... you are probably correct that 90% of the time the local DC will be the logon server. That confuses me as you recognize this but yet in your second example, you still use @LDrive.

Also in an attempt to ascertain what subnet you're in, you check for a sub-string of the IP. Be aware of the following:

Syntax for SubStr(). You need to specify start, length.

@IpAddressx() will pad out the octect to three positions each (plus the dot).

Check out our UDF section. There are some well written UDFs that will do what you want.

While it is possible to SHELL out to batch files, I encourage you to translate the batch file to KiX and run it in-line.

Check out the FAQ on the use of SHELL and RUN.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#21209 - 2002-05-04 04:45 PM Re: Multiples sites and logon scripts - little advice please?
Anonymous
Unregistered


Thanks for the reply - you're right, I didn't think through that using the @ipaddress method that @ldrive won't always be the in the local site.

As for the substr statement I guess it should look like

if substr(@ipaddress0,1,8)="10 .65 ."

I hope to move the whole lot to kixtart, I'm doing it little by little and trying to get the important bits that users notice to run smooth first.

regards
Paul

Top
#21210 - 2002-05-04 04:57 PM Re: Multiples sites and logon scripts - little advice please?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Not sure if the UBB discombobulated your code, so I will give you an example within [CODE] tags

code:
if substr(@ipaddress0,1,8)=" 10. 65."
;do something
endif

Rather than multiple IF - ENDIF statements, since only one can be true, better to do a SELECT CASE.

Have you had a look at the UDFs I mentioned? Search the UDF section for the words "is in subnet" if you haven't.

I assume you are using KiX 4.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#21211 - 2002-05-04 05:06 PM Re: Multiples sites and logon scripts - little advice please?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
If you use the Subnet mask such as 255.255.255.128 generate different subnets (1-127) and (129-254) then lookup CalcLogicalSubnet. This UDF will permit you to easily call a subscript based or perform logical branching based on the client subnet.

Also, if you use W2K domains and install the DScLient on your clients. The site property will do this for you.

[ 04 May 2002, 17:09: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#21212 - 2002-05-04 05:10 PM Re: Multiples sites and logon scripts - little advice please?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Or you use the function ISInSubnet() at http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=12;t=000053.
It checkes whether a specific IP address is part of a network based on the network ID and subnetmask.
You would end up with the following code:
code:
IF IsInSubnet(@IPADDRESS0,'10.65.0.0','255.255.0.0')
SHELL '%COMSPEC% /C /E:1024 '+@LDRIVE+'\B_antivirus.bat'
ENDIF

_________________________
There are two types of vessels, submarines and targets.

Top
#21213 - 2002-05-04 05:41 PM Re: Multiples sites and logon scripts - little advice please?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Jens,
in your example regardless of whether the local or remote DC authenticates you, you are still SHELLing to the authenticating DC contrary to our client's need to SHELL to the local DC.

Paul,
I'm a 'teach a man to fish' kinda guy so I leave it to you to come up with the code.

Since your main site has four DCs, you may want to rethink the methodology to use exception instead. That is, check to see if the @LServer is in the client's subnet. To hard code the server name to the subnet would disadvantage the main site.

Since I don't have an understanding of how your DCs are setup I can only surmise. On my network, my DCs only do authentication, DHCP, DNS, and WINS. All other things, like SQL, NAV, email, etc. are handled by separate application servers. I can see where in a small branch, you may consolidate onto fewer servers, but cannot imagine that to be the case for the main site.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#21214 - 2002-05-04 05:42 PM Re: Multiples sites and logon scripts - little advice please?
Anonymous
Unregistered


We're using 3.64 (if I remember, definately 3.6x)

I took a look at the UDF - I'm not clear what extra this would do for me? (though I'm a kixtart beginner)

So far as using SELECT CASE , given I only have three sites/subnets would there be any noticable difference, or is it simply "best practice" to use CASE?

What's comspec - as in

SHELL '%COMSPEC% /C /E:1024 '+@LDRIVE+'\B_antivirus.bat'

Paul

Top
#21215 - 2002-05-04 05:52 PM Re: Multiples sites and logon scripts - little advice please?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Paul,
you're not keeping up to the posts. Pull up those socks. [Big Grin]

Since you talked about going to AD (actually you said 2000 domian), I assumed that KiX 4 was in the plan. No big deal, for now... you can do it without the UDF. There are enough features in KiX 4 however that you should consider it.

SELECT CASE is a best practice. You can do multiple IFs but it's not as clean.

Like I said, check out the FAQ I pointed out. It answers the %comspec% question. To reiterate, I strongly urge you to move the functionality out of the BAT into KiX if at all possible.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#21216 - 2002-05-04 06:10 PM Re: Multiples sites and logon scripts - little advice please?
Anonymous
Unregistered


Thanks to everyone who replied, I appreciate it.

I think I have a plan for Monday - I'm going to try to "keep it simple" and attempt to rewrite the mash of batch files we currently use into Kixtart - I intend to initially try a simple CASE statement to run commands based on the IP (and therefore location) of the machine.

Les - fully agree with the "teach a man to fish" principle - I appreciate the pointers.

rgds
Paul

Top
#21217 - 2002-05-06 04:46 PM Re: Multiples sites and logon scripts - little advice please?
Rocco Capra Offline
Hey THIS is FUN
*****

Registered: 2002-04-01
Posts: 380
Loc: Mansfield Ohio
My company has over 15 remote sites with a BDC at each location. Each location has a user group with the name of that loaction i.e. Appleton WI has a group called "Appleton", that everyone in the Appleton location is a member of. So in my script I have a SELECT ... CASE ... statment like this...
code:
SELECET
CASE INGROUP("Appleton")
$SERVER = "\\APPFP1NT"
? "[ Your Logon Server is = ( " + $SERVER + " ) ]"
? "[ Mapping H: to Users on ( " + $SERVER + " ) ]"
USE H: $SERVER + "\users"
? "[ Mapping P: to Data on ( " + $SERVER + " ) ]"
USE P: $SERVER + "\Data"
;==========================================================
CASE INGROUP("Agawam")
$SERVER = "\\APPFP1NT"
? "[ Your Logon Server is = ( " + $SERVER + " ) ]"
;==========================================================
CASE INGROUP("Cary")
$SERVER = "\\CARBDC1NT"
? "[ Your Logon Server is = ( " + $SERVER + " ) ]"
? "[ Mapping H: to Users on ( " + $SERVER + " ) ]"
USE H: $SERVER + "\users"
;==========================================================
CASE INGROUP("Cedar Falls")
$SERVER = "\\CEDFP1NT"
? "[ Your Logon Server is = ( " + $SERVER + " ) ]"
? "[ Mapping H: to CEDUsers on ( " + $SERVER + " ) ]"
USE H: $SERVER + "\CEDusers"
? "[ Mapping P: to CEDData on ( " + $SERVER + " ) ]"
USE P: $SERVER + "\CEDData"
;==========================================================
...
and so on...
...
ENDSELECT
...
Blah, blah, blah
...
;==========================================================
;Norton Virus Definition Update (using '$SEVER' var set from above)
;==========================================================
:NAV
? "[ Checking for AntiVirus Update ]"
$NAVFILE = Dir($SERVER + "\netlogon\_auxfiles\*x86.exe")
IF EXIST("C:\NAV") = 0
MD "C:\NAV"
ENDIF
IF EXIST("C:\NAV\" + $NAVFILE + ".log") = 0
DEL "C:\NAV\*.log"
$RC = OPEN(1,"C:\NAV\" + $NAVFILE + ".log",5)
$RC = WRITELINE(1,"Your NAV Definitions were updated with.... " + $NL)
$RC = WRITELINE(1,"[ " + $NAVFILE + " ] at [ " + @TIME + " " + @DATE + " ]")
$RC = CLOSE(1)
? "[ Updating AntiVirus with ( " + $NAVFILE + " ) ]"
RUN $SERVER + "\netlogon\_auxfiles\" + $NAVFILE + " /q"
ELSE
? "[ Your AntiVirus Definitions are up to date ]"
ENDIF

Rocco - trying to be of some help. [Smile]
_________________________
I Love this board!! -------------------- My DEV PC is running KIX 4.22 WINXP Pro

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
0 registered and 611 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.063 seconds in which 0.027 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