Solved

Kixtart IP address based login script

Posted on 2006-11-07
5
1,900 Views
Last Modified: 2008-02-01
Hello,

Does anyone know where I can find a sample Kixtart login script for IP based mappings?  What I would like to do is have the script look at the IP address of the PC, then set it to map drives to the server in the same subnet as the PC, rather than where the user account is based out of in Active Directory.  We have alot of users who move around to different buildings, but we don't want them mapping to servers in other buildings even if their account may be in a different building.  I already have the Kixtart software to get started.

Thanks in advance for your help.
0
Comment
Question by:miket71
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:Yogalingam
ID: 17891978
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Establishes $location variable, determined by subnet
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
:IPCHECK
$address = @IPADDRESS0
$subnet = SubStr($address,9,3)
$subnet1 = SubStr($address,13,3)
Select
Case $subnet = "xxx" And $subnet1 >= "xxx" And $subnet1 <= "xxx"
$location = servername-1
"net use d: \\" & $location &"\" & @username &" /persistent"
Case (($subnet = "xxx" And $subnet1 >= "xxx" And $subnet1 <= "xxx") $location = servername2
"net use d: \\" & $location &"\" & @username & " /persistent"
EndSelect

See the link http://www.adminscripteditor.com/forum/tm.asp?m=8320

For more details.
0
 
LVL 5

Expert Comment

by:Yogalingam
ID: 17892004
0
 

Author Comment

by:miket71
ID: 17892937
Thanks for the reply.  Now I was wondering if you can help explain some of the variables and meanings to help get me started.

In an example I have, I would be using a PC on a 10.1.1.X subnet, so I would want it to map to \\SERVERone\SHAREone which is also on a 10.1.1.X subnet.  My location for 10.1.1.X subnet would be called LOCATIONone.

I'm not quite sure how the Address, Subnet, and Locations I use would fit into the script, as I'm starting from scratch here.  I have 13 locations altogether, but with a little more help for the first location in the script, I should be able to add the rest of them in by myself, hopefully.
0
 
LVL 84

Accepted Solution

by:
oBdA earned 350 total points
ID: 17909731
The code above will NOT return a subnet. It's just looking at the third and fourth octett. A subnet is still calculated by a logical and of the IP address and the net mask.
Here's an example that will calculate the real subnet, including a case statement for the different locations that should get you going:

Dim $SubnetArray[3], $ArrayMask[3]
? "Getting IP information ..."
$SubnetArray = Split(EnumIPInfo(0, 0), ".", -1)
$MaskArray =  Split(EnumIPInfo(0, 1), ".", -1)
for $i = 0 to 3
  $SubnetArray[$i] = Val($SubnetArray[$i]) & Val($MaskArray[$i])
next
$Location = "Subnet-" + $SubnetArray[0] + "." + $SubnetArray[1] + "." + $SubnetArray[2] + "." + $SubnetArray[3]
select
  case ($Location = "Subnet-10.1.1.0")
    ? "Current subnet: 10.1.1.0"
    use X: "\\ServerOne\SomeShare"
  case ($Location = "Subnet-192.168.1.0")
    ? "Current subnet: 192.168.1.0"
    use X: "\\ServerTwo\SomeShare"
endselect
0
 

Author Comment

by:miket71
ID: 17914764
Great, thanks very much for your help.  We will be adding about 13 more subnets to the script so that the IP address of the PC will determine what server and share(s) it will map to.  We have some users who move around to different buildings in the course of a week, so this will come in very handy to make any PC map to and run the database applications based on the IP address/subnet of the PC/building where they are, and not where their login account is in Active Directory.  I will keep you posted on the results.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction How to create multiboot configuration with XP\Vista and Windows 7 on it? And most important question - how to do this correctly so not to have any kind of nightmares we get when system gets screwed? First of all one should realize t…
Many people tend to confuse the function of a virus with the one of adware, this misunderstanding of the basic of what each software is and how it operates causes users and organizations to take the wrong security measures that would protect them ag…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question