Page 1 of 1 1
Topic Options
#18127 - 2002-03-01 03:55 AM Map drives based on subnet
johnt Offline
Fresh Scripter

Registered: 2002-03-01
Posts: 6
I have 6 different subnets in one domain. Currently users in each subnet use a separate login script to map drives etc. Is there a way to use just one script, and map different drives depending on which subnet they login from? I’m very new at using Kix, so please be gentle.
Top
#18128 - 2002-03-01 04:35 AM Re: Map drives based on subnet
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
yea you can do this no problem.

you will need these UDF's

Subnet() - will tell if a given ip# is in a specified subnet.

BInaryIP()

to use these udf's just place then anywhere in your script. or put them in a seperate file and use the call command to load them.

call "udfs.kix"


your code will be something like this.

code:

;for all computers in the 10.2.0.0 255.255.0.0 subnet
if subnet(@ipaddress0,"10.2.0.0","255.255.0.0") = 1
? "this computer is in the 10.2.0.0 255.255.0.0 subnet"
endif

if your have anyquestion, just ask.

Bryce

Top
#18129 - 2002-03-01 09:13 AM Re: Map drives based on subnet
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
For my 900th Post I only have a minor addition to Bryces answer.

Hello Johnt, and welcome to the board.

Bryce writes some really great stuff. I'm sure his will work just fine. I've used a lot of his stuff and it has worked quite well for me.

If your using an older version of KiXtart v3.63 this code should work.

code:
SELECT
CASE (SUBSTR(@IPADDRESS0,1,11)) = "122.100.120"
USE G: /DELETE /PERSISTENT
USE G: "\\MYSERVER\MYSHARE"
CASE (SUBSTR(@IPADDRESS0,1,11)) = "122.100.121"
USE H: /DELETE /PERSISTENT
USE H: "\\MYSERVER\MYSHARE"
CASE (SUBSTR(@IPADDRESS0,1,11)) = "122.100.122"
USE I: /DELETE /PERSISTENT
USE I: "\\MYSERVER\MYSHARE"
CASE (SUBSTR(@IPADDRESS0,1,11)) = "122.100.123"
USE J: /DELETE /PERSISTENT
USE J: "\\MYSERVER\MYSHARE"
CASE (SUBSTR(@IPADDRESS0,1,11)) = "122.100.124"
USE K: /DELETE /PERSISTENT
USE K: "\\MYSERVER\MYSHARE"
CASE (SUBSTR(@IPADDRESS0,1,11)) = "122.100.125"
USE L: /DELETE /PERSISTENT
USE L: "\\MYSERVER\MYSHARE"
ENDSELECT


Here are some examples of the USE command from the manual.


code:
USE E:    "\\SERVER\PUBLIC" /PERSISTENT
USE * /DELETE
USE E: "\\SERVER\PUBLIC" /user:Yogi /password:Bear
USE E: "\\SERVER\PUBLIC"
USE LPT1: "\\SERVER\LASER" /user:testlan\USER1
USE L: /DEL
USE LIST
USE H: @HOMESHR ; connect to user's home share
IF @ERROR = 0
H: ;
CD @HOMEDIR ; change directory to user's home directory
ENDIF

[ 01 March 2002: Message edited by: NTDOC ]

Top
#18130 - 2002-03-01 11:28 PM Re: Map drives based on subnet
johnt Offline
Fresh Scripter

Registered: 2002-03-01
Posts: 6
Thanks for the responses. I used bryce’s suggestion, and It works like a champ. I just need to do some more testing from each subnet. Thanks again.
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 931 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.059 seconds in which 0.031 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