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.
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.
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.
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
if "%ipnet" = "C0A8" then
map root h:=.clustervolume.context.ou.tree
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.)
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.