Hi,
I have a script that maps network printers in the same subnet as the client logs in. This works fine with subnetmasks 255.255.255.0 . Now however there are subnets with 255.255.255.192 and 255.255.255.128 and using the same third octet if thats the correct name. Ie
10.2.129.1 - 10.2.129.62
10.2.129.65 - 10.2.129.126
10.2.129.129 - 10.2.129.190
How do I identify this? The method I´m using gives the same result for these subnet 10.2.129.
See script below
This is in a Citrix enviroment and thats why I use the %CURRENT_CLIENTIP% variable
Code:
; Printmappings depend on subnet
$ip = expandenvironmentvars('%CURRENT_CLIENTIP%')
$ipnospaces = Join(Split($IP," "),"")
If InStr ($ipnospaces,"192.168.0.")
Goto "loc1"
Endif
If InStr ($ipnospaces,"192.168.50.")
Goto "loc2"
Endif
If InStr ($ipnospaces,"192.168.51.")
Goto "loc3"
:loc1
Addprinterconnection ("\\srv\loc1prnt1")
Addprinterconnection ("\\srv\loc1prnt2")
:loc2
Addprinterconnection ("\\srv\loc2prnt1")
Addprinterconnection ("\\srv\loc2prnt2")
:loc3
Addprinterconnection ("\\srv\loc3prnt1")
Addprinterconnection ("\\srv\loc3prnt2")
Endif