Novell Cool Solutions

Identify a User’s Location During Login



By:

March 9, 2007 7:59 pm

Reads:4,661

Comments:0

Score:Unrated

Print/PDF

Problem:

The best way to identify a user’s location (onsite or offsite) during login and thereby select options to run or not within the login script.

Solution:

By reading the network address portion of their %NETWORK variable and storing it in a temporary variable, this can be used in “IF” statements to avoid executing certain programs (Installs, updates, etc.) when the user is connecting from offsite.

Update: 08/24/2007

By storing the significant portion of the network address in the IPNET environment variable, it can also control distribution of ZENworks Apps and ZENworks distributed configuration settings by requiring the app to verify the value of the environment variable prior to app distribution. This way, when your users visit another location in your company, outside your responsibility, and they log into a local workstation there, neither your login script, nor your ZENworks apps/configs, will get distributed to that “foreign” workstation.

Example:

There is not a variable that prints the IP address directly, but there is the “Network” variable. The “Network” variable is the IP address in HEX. You can offset the “Network” variable.
For example if your IP address is 192.168.12.45 then your “Network” variable would equal (in HEX) C0-A8-0C-2D. To see this in a login script you can add this to your login script:

Write "Network address = %network"

If your IP is 192.168.12.45 then the output of the above command would be:

"Network address = C0A80C2D"

Now here’s the fun part. I make a variable “ipnet”. Add the next 5 lines to your login script:

set ipnet="%NETWORK" >> 4
write "%ipnet"
if "%ipnet" = "C0A8" then
map root h:=.clustervolume.context.ou.tree
else
map root h:=.ipxloginmethodhere.ou.tree
endRemember the C0A8 matches 192.168. You'll have to change that to match
your subnet.  The >> 4 part takes off the last 4 digits of the HEX address.
If you change >> 4 to >> 2 then only two digits would come off and
the example above would look like: "C0A80C"

(PS. any simple calculator can translate decimal to HEX and vise versa. Use KCalc or even the Windows Calc program.)

Environment:

Requires TCP/IP.

Hat’s off to Brad Bendily, whose original post in January 2005 taught us to crack open the Network variable! (The explanation in the example on how to use this method is straight from his post!) I’m just using the same means to a different end.

0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.
Loading...Loading...

Categories: Uncategorized

0

Disclaimer: This content is not supported by Novell. It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test it thoroughly before using it in a production environment.

Comment

RSS