Current grade would be "C-", mostly because you have data in your code. Bad idea.. Every time you edit the "data" you have the chance to screw up your code.

Data should be in a data file, separate from your code. Using an INI file, similar to:
 Code:
[SUBNET_LOOKUP]
10.11.1.0/24=Server1
10.11.2.0/24=Server2
10.0.0.0/8=Default_Server
you could use EnumINI to return an array of network/mask values. Note that the last entry is a network-wide default. You can specify any size network with this method, not just /24.

Using IsInSubnet(), you could pass the local IP address and the array of network addresses and know precisely which subnet your host was in. Here's some pseudo-code:
 Code:
; This loads an array of W.X.Y.Z/mask network ranges
$aNetworks = EnumIni('\\server\share\subnets.ini', 'SUBNET_LOOKUP') ; load subnet table from common location
; Get my IP address in normalized (no spaces) format
$MyIP = Join(Split($IPADDRESS0, ' '), '')                           ; remove spaces
; Pass IP and network table to UDF, returning an array of 0/1 values. 
; If the table is defined in most to least specific order, the first 
; value that is set represents the network subnet where the host resides
$aNetwork = IsInSubnet($MyIP, $aNetworks)                           ; get network ID (array element)
; find the first "1" in the array returned (may required additional args)
$Net = AScan($aNetwork, 1)                                          ; get first network that host is a member of
; Using the element returned above, get the value to read from the INI file
$Network = $aNetworks($Net)                                         ; return the network/mask for lookup
; Read the server name from the central INI file
$Server = ReadProfileString('\\server\share\subnets.ini', 'SUBNET_LOOKUP', $Network) ; lookup the server name for this network
In this manner, only the central INI data file changes. Once you write and test your code, you never touch it again.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D