|
I have an update .... Take a look at my script and see if it makes any sense. Yes I know it only will work in a class C subnet and also on a machine with only one NIC card. I got to the point where I get the desired result now I just have to find a way to write the data back into the machine. I was thinking of using WMI , or using Netsh set command on teh W2k and WXP machines. The NT 4 machines I could use WMI or I could write to the registry. Please let me know what you guys think You really have been great Help Thanks. Afternoon I thought I give you guys an update on what I have come up with . Let me know if you see some kind of problem with it.
Break on $IpPart1 = Ltrim(SubStr(@IPADDRESS0, 1, 4)) $IpPart2 = Ltrim(SubStr(@IPADDRESS0, 5, 4)) $IpPart3 = Ltrim(SubStr(@IPADDRESS0, 9, 4)) $IpPart4 = Ltrim(SubStr(@IPADDRESS0, 13, 3)) $IPAddressComplete = $IpPart1 + $IpPart2 + $IpPart3 + $IpPart4 $IPSUBN=$IpPart1 + $IpPart2 + $IpPart3 $SBM=+EnumIPInfo(0,1) $Octet = Val(SubStr(@ipaddress0,13,3)) If $SBM Select Case $SBM="255.255.255.0" Goto Oneseg Case $SBM="255.255.255.128" Goto Halfseg Case $SBM="255.255.255.192" Goto Quadseg Case $SBM="255.255.255.224" Goto 252 EndSelect :Oneseg $NDG=$IPSUBN + 252 $NDG1=$IPSUBN + 251 Goto end :Halfseg Select Case $Octet<=126 $NDG=$IPSUBN + 124 $NDG1=$IPSUBN + 123 Case $Octet<=254 $NDG=$IPSUBN + 251 $NDG1=$IPSUBN + 252 EndSelect Goto end :Quadseg If $OCTET Select Case $Octet<= 62 $NDG=$IPSUBN + 60 $NDG1=$IPSUBN + 59 Case $Octet<=126 $NDG=$IPSUBN + 124 $NDG1=$IPSUBN + 123 Case $Octet<=190 $NDG=$IPSUBN + 188 $NDG1=$IPSUBN + 187 Case $Octet<=254 $NDG=$IPSUBN + 251 $NDG1=$IPSUBN + 252 EndSelect :252 :end
?" Your default gateway is address is "$NDG ?" Your default gateway is address is "$NDG1
|