#189381 - 2008-09-03 05:41 AM
Compare home drive location with logon subnet
|
Dunit
Fresh Scripter
Registered: 2003-12-10
Posts: 5
|
Hi Everyone,
I'm trying to achieve something here but am not sure of the best way to go about it. Basically the situation is that my workplace employs a lot of people who move from office to office on a regular basis. I'm in Australia so the geographic distances between the offices are quite large (Perth to Melbourne is over 3,000km for example).
Anyway IT is not always told that a user has moved across the country and we only find out when the user calls to complain about system speed or logon time being slow. It's obviously because they are downloading their roaming profile and using their home drive over the WAN (fairly slow links).
What I'd like to do is something like the following, though I am open to suggestions:
- Define a list of home drive servers - Determine the IP address (and therefore subnet) of the user logging on. - Extract the users home location in AD and put result into a variable (would dsget be appropriate or is there a better way?) - Use split to strip the servername from the variable, with slashies as the delimiter. Turning "\\servername\share" into just "servername" - IF the user is in a particular subnet (say Melbourne's subnet .208) and their servername is a server in Perth ("Perthserver") then do <action> like write a log or pop up a messagebox (not too fussed what the action is yet).
I already have this code which extracts the IP address quite nicely:
; Set IP address in a human friendly format
$ipa = LTRIM(SUBSTR(@IPADDRESS0,1,3))
$ipb = LTRIM(SUBSTR(@IPADDRESS0,5,3))
$ipc = LTRIM(SUBSTR(@IPADDRESS0,9,3))
$ipd = LTRIM(SUBSTR(@IPADDRESS0,13,3))
$ipNO = $ipa + "." + $ipb + "." +$ipc + "." +$ipd
Existing code already maps some local common drives accordingly by using the 3rd octet variable "$ipc":
SELECT
CASE $ipc = "231"
USE T: '\\SERVERNAME\TEMP'
CASE $ipc = "208"
USE T: '\\SERVERNAME\TEMP'
ENDSELECT
..etc
So it's the above pseudocode that I'm looking for a bit of advice on. If anyone has any ideas feel free to post them - you may have a totally different approach which is no worries at all. I've just been told to "Make the logon script tell us whether the user is logging on at a site where their home drive (and maybe profile) is not located"!
Thanks for your advice!
Andrew.
|
Top
|
|
|
|
#189385 - 2008-09-03 12:08 PM
Re: Compare home drive location with logon subnet
[Re: Gargoyle]
|
Glenn Barnas
KiX Supporter
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
|
My pre-built login script already supports this, on several levels.
If you know where the user is globally, you can define the profile to run the login script from a subfolder. IE - "au\kix32 au\kixtart.kix" for users in Oz, "eu\kix32 eu\kixtart.kix" for users in Europe, and "na\kix32 na\kixtart.kix" for users in North America.
Now that globalization issues are resolved, you can use AD Sites, department OUs, and groups to control specific resources. Some might need to be available no matter where the user is. This is basic stuff - if a user is a member of a group/OU, map/don't map, or map if not a member configurations are all possible.
Finally, you can define regional settings to rewrite the mapping path. Lets say you have 50 shops across Oz, each has a server for local storage. You can define the same share name on each server. The login script would use Path Rewrite technology to change the server name, or even the entire path that's mapped to a drive letter, based on OU, AD Site, or IP Subnet.
In addition to mapping drives/printers, the script can display messages and run commands (even call kix scripts with a common environment!) using the same Path Rewrite technology.
If you want to write your own code, I'd convert the IP to a standard string without spaces, and use an IsInSubnet() to determine which network your're in. The GetNetInfo() UDF on my site will be very helpful - you feed it an IP, it opens a subnets.inf file that lists your networks and other data, and it returns the specified field when it finds a subnet match. You can use that to easily translate IP addresses to server names or even entire UNC paths.
I'd definitely NOT put your IP/URL/Server data in your script, since every time you open your script to change data, you run the risk of damage. Keep your mapping data outside your script - your environment's way beyond the "mom & pop shop" mentality of combined data & script.
Glenn
BTW - if you want to try my login script with IP rewrites, PM me - It's a recent update and not through final testing. It should be complete this week, but I can get you an early release.
_________________________
Actually I am a Rocket Scientist!
|
Top
|
|
|
|
#189413 - 2008-09-04 12:44 AM
Re: Compare home drive location with logon subnet
[Re: Gargoyle]
|
Dunit
Fresh Scripter
Registered: 2003-12-10
Posts: 5
|
Hi Gargoyle,
Great suggestions - I'll look further into what you have suggested. And the email thing is a really good idea. I'll probably make it send an email to the service desk. Users tend to pay very little attention when messages are directed at them
Thanks again!
|
Top
|
|
|
|
#189414 - 2008-09-04 12:54 AM
Re: Compare home drive location with logon subnet
[Re: Glenn Barnas]
|
Dunit
Fresh Scripter
Registered: 2003-12-10
Posts: 5
|
G'day Glenn,
Thanks very much for your post - really informative stuff! I'd really be interested in your script to get some ideas so I'll PM you on that.
Suggestion noted on the IP/URL data not in the script itself and I'll look at some of the UDF's and methods you mentioned.
I do use the same share names on all my servers so that will make things a lot easier. The server names have undergone a few naming convention changes over the years with company name changes and business unit changes but the shares have remained the same on all boxes (I have around 70 servers around Oz, tho not all of them are file servers obviously!).
Thanks again to all for suggestions - my Kix scripting is only fairly basic, tho I do already use a few things like INGROUP and other basic methods.
Thanks again
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 259 anonymous users online.
|
|
|