We have a fairly basic script in place that checks the IP address of the computer to determine it's location and then calls a sub-script based on that location to map drives and printers.

It's been working for about 4-5 years, and now suddenly (at random) stops working for some machines. We have a mix of Windows XP and Windows 7 machines.

I am absolutely stumped as to why, and it is seemingly random. I have a test machine that runs both XP and 7 and the scripts run fine on it, yet daily I am getting a call about drives not mapping and testing those machines the script does not run.

Since most machines have multiple NICs it goes through them all looking for a valid IP:

 Code:
For $NIC = 0 to 5
	Select
		Case EnumIPInfo ($NIC,0) >= "172.16.32.0" And EnumIPInfo ($NIC,0) <= "172.16.35.255"
			$loc = "sch"
				Call "sch.kix"
		Case EnumIPInfo ($NIC,0) >= "172.16.40.0" And EnumIPInfo ($NIC,0) <= "172.16.43.255"
			$loc = "nam"
				Call "nam.kix"
		Case EnumIPInfo ($NIC,0) >= "172.16.44.0" And EnumIPInfo ($NIC,0) <= "172.16.47.255"
			$loc = "gut"
				Call "gut.kix"
	EndSelect
Next
:End
Exit


Going through this, no Case is ever selected and the script completes normally but never calls a sub-script.

I added a quick snippet to display the enumeration of the NIC addresses at the beginning:

 Code:
For $addr = 0 to 5
	$card=EnumIPInfo($addr,0)
	$addr
	$card
	?"Press any key..." GET$
Next


This works and displays all of the IP addresses for the computer, yet again the sub-script is never called.

Any help is appreciated.


Edited by Destinova (2013-02-04 09:23 PM)