I'm trying to build a list of servers that workstations should contact depending on the subnet they are in.
What would be the simplest way to break an IP address down into the first three octets and then compare it against a list of the servers the workstations should contact. Basically, if the workstation is in the 10.1.1.x subnet, it would go to server A and if it is in the 10.2.1.x subnet it would go to server B, etc.
This is sloppy but I just threw it together to show the breakdown of the IP.
What would be the simplest way to break an IP address down into the first three octets and then compare it against a list of the servers the workstations should contact. Basically, if the workstation is in the 10.1.1.x subnet, it would go to server A and if it is in the 10.2.1.x subnet it would go to server B, etc.
This is sloppy but I just threw it together to show the breakdown of the IP.
Code:
a = InStr(1, strIPAddress, ".")
b = InStr((a + 1), strIPAddress, ".")
c = InStr((b + 1), strIPAddress, ".")
lngOctet01 = Mid(strIPAddress, 1, (a - 1))
lngoctet02 = Mid(strIPAddress, (a + 1), (b - a))
lngoctet03 = Mid(strIPAddress, (b + 1), (c - b))