#24882 - 2002-07-12 12:21 AM
Re: Drive mapping according to server name or IP address?
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Dax,
Personally, you should pick this up by group and not a "marker" file..
Note: I have added in some things to think about with this
code:
IF INGROUP ("Accounting") USE P: "\\gbtacksrv01\apps" USE S: "\\gbtacksrv01\@userid$$" ELSE USE P: "\\gbtsrv01\apps"USE S: "\\gbtsrv01\@userid$$" ENDIF IF INGROUP ("Domain Users") USE S: "\\gbtacksrv01\shared" USE LPT1: "\\gbtacksrv01\ackmitalj" endif
One thing to think about with the SELECT..CASE..ENDSELECT statement, it will leave on the first true condition it finds.
{first edit - enclose share point with double quotes} {second edit - removed /persistent:no with nothing as this would be the same thing} HTH,
Kent [ 12 July 2002, 09:38: Message edited by: kdyer ]
|
|
Top
|
|
|
|
#24883 - 2002-07-12 12:37 AM
Re: Drive mapping according to server name or IP address?
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Dax, by far, the best solutions for your issue are related to the use of the combination of the client's (IP address and subnetmask). The logical subnet on which a client is located is determined by the bitwise "AND" of each octet of the IP and MASK.
So: IP = 123.12.45.100 MASK = 255.255.255.128
Logical subnet is calculated by performing bitwise operations: 123 & 255 = 123 12 & 255 = 12 45 & 255 = 45 100 & 128 = 0
123.12.45.0 is the logical subnet. Clients with IP addresses 123.12.45.1-127 are located on this subnet based on the mask. Clients 123.12.45.129-254 are located on subnet 123.12.45.128 if they all have a subnet mask listed above.
To find your logical subnets use this UDF and script. Supply some of your clients IP and masks and checkout the result. code:
$IP = "x.x.x.x" $SNmask = "y.y.y.y" ? CalcLogicalSubnet ($IP, $SNmask)
Function CalcLogicalSubnet ($IP, $SNmask) ; Version 2.0 ; This function calculates the logical subnet for a given IP address and subnet mask. ; The $IP parameter can be padded with spaces as from @IPADDRESS0 or without ; as from EnumIPinfo(). ; ; Sets two exit codes that are passed to @Error ; 1 = Improperly formatted IP address ; 2 = Octet out range (0-255)
dim $IP, $SNmask dim $i ;Counter for looping through 4 octets of the IP and subnet mask dim $arrayIP ;Holds the string representation of the IP address octets. dim $arraySN ;Holds the string representation of the subnet mask octet. dim $Subnet ;Holds the string that becomes the logical subnet. dim $x, $y ;Holds value of IP and SNmask octet.
$arrayIP = split($IP, ".") $arraySN = split($SNmask, ".")
If UBound($arrayIP) = 3 and UBound($arraySN) = 3 For $i=0 to 3 $x = Val(LTrim($arrayIP[$i])) $y = Val(LTrim($arraySN[$i])) If $x >= 0 and $x < 256 and $y >= 0 and $y < 256 $Subnet = "" + $Subnet + ($x & $y) + "." Else Exit(2) Endif Next $CalcLogicalSubnet = substr($Subnet, 1, len($Subnet)-1) Exit(0) Else Exit(1) Endif Endfunction
You then could do something like: code:
if "your logical subnet" = CalcLogicalSubnet ($IP, $SNmask) do something... endif
|
|
Top
|
|
|
|
#24885 - 2002-07-12 12:47 AM
Re: Drive mapping according to server name or IP address?
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Done,
Sorry about that..
Kent
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 820 anonymous users online.
|
|
|