I single-stepped through your script and the problem is that after reading and verifying the line with the IP address, you count lines rather than verify the GW line. You are in fact not reading in the GW line but rather the Mask line, so you're comparing the wroong items.
quote:

IP Address. . . . . . . . . . . . : 10.198.51.6
10.198.51.6

Subnet Mask . . . . . . . . . . . : 255.255.255.255
255.255.255.255
if 10.198.51.6 = 255.255.255.255


_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.