ryanro
(Fresh Scripter)
2002-01-29 05:23 PM
How hard is this to do with Kix???

Ok, here is the scenerio: I have 3 offices with 3 domain controllers in the same domain. I want to write a script that will allow a user in the remote office to login there and map all of his drives to the local server. Then if the user comes to another office, I want him to login with the same login but map to the shares on the local server in the new office. Here are the details:

Primary Domain Controller : NT1 Subnet: 10.0.0.0 255.255.255.0 Remote DC : Gonzales Subnet: 10.0.2.0 255.255.255.0 Name of login scripts that will be used: For Primary DC : perkins.bat For Remote DC : gonzales.bat

I'm trying to figure this out in vbs but someone told me to try kix first b/c it's a lot easier and more powerful than vbs. Does anyone out there know how to do this with kix?? Thanks in advance for your help..

Ryan

Radimus
(KiX Supporter)
2002-01-29 05:30 PM
Re: How hard is this to do with Kix???

use the enumipinfo() command to determine which gateway is active on the lan adapter.

then run a select/case series to compare the results and match them to a specific server at that site.

then map your server using that server.

ryanro
(Fresh Scripter)
2002-01-29 05:31 PM
Re: How hard is this to do with Kix???

Speak english please...I'm new to scripting and have no clue where to start with this. Thanks for the help ...Can you write it for me based on the info I gave you??

Thanks
Ryan

Radimus
(KiX Supporter)
2002-01-29 05:37 PM
Re: How hard is this to do with Kix???

code:

$gateway=enumipinfo(0,3)

select
case $gateway=" 10. 0. 0. 1"
$localserver="NT1"
case $gateway=" 10. 0. 2. 1"
$localserver="gonzales"
case 1
? "can't figure out where I am. Quitting"
quit
endselect

use h: "\\$localserver\share1"
use m: "\\$localserver\share2"
use s: "\\$localserver\share3"




ryanro
(Fresh Scripter)
2002-01-29 05:50 PM
Re: How hard is this to do with Kix???

Thank you!!!

ryanro
(Fresh Scripter)
2002-01-29 06:03 PM
Re: How hard is this to do with Kix???

Whoops, one thing I forgot to mention is that if they are logging in to NT1, they will need to map drives to different servers and if the login to gonzales, they will only map to one server. Let me ask you this, is there a way in kix to call batch files, for example if it sees that the subnet is nt1, can it call nt1.bat and vice versa for gonzales. If so, can you give me an example.

Thanks again for the help

Ryan

Bryce
(KiX Supporter)
2002-01-29 06:23 PM
Re: How hard is this to do with Kix???

if a user is logging in the the 10.0.0 subnet you want to map X drives, and if logging in from the 10.0.2 subnet map Y drives... is this right?

Bryce

ryanro
(Fresh Scripter)
2002-01-29 06:25 PM
Re: How hard is this to do with Kix???

yeap, exactly..Here it is in full:

User logs in to 10.0.0.1:
net use j: \\nt3\public
net use p: \\nt1\projects
net use i: \\nt2\shared

User logs in to 10.0.2.1

Net uses everything on one server, not multiple..

Bryce
(KiX Supporter)
2002-01-29 06:30 PM
Re: How hard is this to do with Kix???

If you are using Kix4.0 i suggest using one of the 2 Subnet UDF's that are out there.


Subnet() By Bryce
IsInSubnet() By sealeopard

Bryce

ryanro
(Fresh Scripter)
2002-01-29 06:39 PM
Re: How hard is this to do with Kix???

Now I'm really confused ..Keep in mind, I've never used kix or programmed before. My boss asked me to do this for him and I have no clue where to start...

Radimus
(KiX Supporter)
2002-01-29 06:44 PM
Re: How hard is this to do with Kix???

code:

$gateway=enumipinfo(0,3)
select
case $gateway=" 10. 0. 0. 1"
shell "\\nt1\netlogon\perkins.bat"
case $gateway=" 10. 0. 2. 1"
shell "\\gonzales\netlogon\gonzales.bat"
case 1
? "can't figure out where I am. Quitting"
quit
endselect



ryanro
(Fresh Scripter)
2002-01-29 06:45 PM
Re: How hard is this to do with Kix???

Thanks again!!! Now do you know how to do it with vbs

Ryan

[ 29 January 2002: Message edited by: ryanro ]

bleonard
(Seasoned Scripter)
2002-01-30 05:21 PM
Re: How hard is this to do with Kix???

Another way, use @LSERVER value, which will tell you the domain server authenticating the client. Can be something such as:

code:

SELECT
CASE (@LSERVER = "\\PDC")
$localsvr = "PDC"
CASE (@LSERVER = "\\BDC1)
$localsvr = "BDC1
CASE (@LSERVER = "\\BDC2")
$localsvr = "BDC2
ENDSELECT

This especially true if running KiX 3.x, as 'enumipinfo' is only in KiX 4.x.

Bill

ryanro
(Fresh Scripter)
2002-01-30 05:32 PM
Re: How hard is this to do with Kix???

It still isn't working, it jumps straight to case 1 and quits....

LonkeroAdministrator
(KiX Master Guru)
2002-01-30 06:35 PM
Re: How hard is this to do with Kix???

ryanro, instead of
case $gateway=" 10. 0. 0. 1"
try it with:
case instr("$gateway","10.0.0.1")
or just
case $gateway=" 10.0.0.1"

in the case 1 print out the gateway variable to see which is the correct syntax.
like:
case 1
"gateway is $gateway" get $
quit

bleonard
(Seasoned Scripter)
2002-01-30 07:55 PM
Re: How hard is this to do with Kix???

ryanro -
What version of KiX are you using?


ryanro
(Fresh Scripter)
2002-01-30 08:42 PM
Re: How hard is this to do with Kix???

The most recent one from this site...

Les
(KiX Master)
2002-01-30 08:50 PM
Re: How hard is this to do with Kix???

ryanro,
Watch your spacing on the IP. The examples are all over the map.

Everyone is offering up suggestions, yet you don't say what you're using so how can anyone know what's going wrong. Try posting some code.

ryanro
(Fresh Scripter)
2002-01-30 08:55 PM
Re: How hard is this to do with Kix???

Don't worry about it, I got it. Thanks to the post about seeing what gateway it's using. Thanks for all the help everyone!!!!