Sorry, but Mart's example of using string comparisons is an overly simplistic method of network subnet identification, and only works if you are on a classful boundary. This is fairly unlikely in mid to large size networks.

The first thing to do is to convert your IP address into a normalized dotted-decimal string:
 Code:
$MyIP = Join(Split(@IPADDRESS0, ' '), '')
This removes the spaces from the @IPADDRESS0 macro. Note that use of this macro may be convenient, but if your system has multiple IP addresses, or is multihomed, it may not return the address that you are interested in. There are UDFs that can query the tcp/ip configuration and return all of the bound IP addresses from all adapters. Just something to be aware of when that one stubborn system doesn't work like all the rest. \:\)

As for network comparisons, what happens when you have a CIDR subnet? Something other than a natural Class A, B, or C? (Realize that 10.1.2.3/24 is NOT a class C simply because the mask is 255.255.255.0!) What about 192.168.16.128 / 255.255.252.0? There are two UDFs that perform CIDR network calculations that make "In Subnet" type of procedures easy.

The first is fairly simple - InSubnet("address", "network/mask") - will return True if the "address" is in the defined "network/mask". This is all done with mathematical calculations.. the "address" is converted to a double-precision number. The Network is also converted to a number, and the mask is used to calculate the end address of the network. From there, it's a simple task to determine if the address is between the network's starting and ending addresses. There's no strange string manipulation, and the process works for any subnet/supernet. Of course, using the prebuilt UDFs hides all of the "magic" - give it an address and a network and it says "yea" or "nay"! The latest version of InSubnet can be downloaded from the KixLib resources page of my web site.

The second UDF is a bit more complex, but much more powerful. IsInSubnet will accept an address and network / mask similar to InSubnet(). Where this UDF excels is that you can pass it an array of network/mask parameters, and the UDF will return an array indicating which network or networks the address is part of. Think about this - you have a large network at one site. It has 4 subnets. Your array of networks could consist of 5 specific items - the entire network at the location and the 4 subnets. Thus, any computer at that site would be a member of 2 networks - the large site network and one of the 4 subnets. This allows mapping of resources by site and then by subnet at the site.

Our Universal Login Script uses InSubnet technology to authorize resources by network location.

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