Quote:
Define sites based on IP

site a = 192.168.1.0 = certain printers/mapped drives
site b = 192.168.2.0 = certain printers/mapped drives

To detect client IP (also code to get rid of IP spaces) and map a drive to the relevant site above, thanks.


Are all your networks /24 (255.255.255.0)?

The simplest code using built-ins that fulfils your request is something like this:
 Code:
$sMyIP=Replace(@IPADDRESS0," ","") ; Lose spaces from primary network adaptor address.
$sMySubnet=Join(Split($sMyIP,".",3),".") ; Drop trailing (host) address octet assuming /24 subnet

"   Raw IP address: '"+@IPADDRESS0+"'"+@CRLF
"Cooked IP address: '"+$sMyIP+"'"+@CRLF
"           Subnet: '"+$sMySubnet+"'"+@CRLF


Select
Case $sMySubnet="192.168.1"
	; Map drives and printers for ".1" subnet here
Case $sMySubnet="192.168.2"
	; Map drives and printers for ".2" subnet here
Case Default
	; Map drives and printers for everyone else here
EndSelect

Exit 0


This makes a number of assumptions about your environment, e.g. subnet masks are all /24 and @IPADDRESS0 is the adaptor that drives your subnet check.