Solved

Kixtart IP address based login script

Posted on 2006-11-07
5
1,848 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
  • 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 83

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Often we come across situations wherein our batch files would be needing to reboot Windows for a variety of reasons. A few of them would be like: (1) Setup files have been updated whose changes can take effect only after a reboot …
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now