Determining the Location of Hosts with Multiple NICs/Subnets

Version 5
    Share This:

    We ran into an issue determining the location of a host based on the subnet. I had used the template that Nick Smith shared on at Trending in Support: Location, Location, Location which is great but I wanted to search through all of the subnets listed on a host when there were multiple network interfaces. The problem I kept running into is when Nick's pattern ran, it only used the 1st subnet it found, where sometimes this was an address that wasn't valid in our situation like a 192.168 (private) or 169.254 address. I extended his pattern to loop through the multiple subnets it found on each host and as soon as it locates a valid one in the table it stops and sets the location on the host.

     

    I posted this in case anyone else might find it useful.

    Nick P G Smith