|
Thanks for the info I was seeing that problem being discussed on the boards here. Well Here is a modified script does this make any sense to do ?
Break On $hklm='HKEY_LOCAL_MACHINE' select case instr(@PRODUCTTYPE,'Windows NT') $OS_SHORT='WinNT' case instr(@PRODUCTTYPE,'Windows 2000') $OS_SHORT='Win2K' case instr(@PRODUCTTYPE,'Windows XP') $OS_SHORT='WinXP' case 1 return endselect
$tempfile = "%temp%\ipconfig.tmp" Shell '%comspec% /c ipconfig /all | find /i "Subnet Mask" >"$tempfile" 2>nul' If Open(1,$tempfile) = 0 $line = ReadLine(1) $SBNM = Ltrim(SubStr($line,InStr($line,":")+1)) ?"Subnet Mask=" $SBNM EndIf $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 $Octet = Val(SubStr(@ipaddress0,13,3)) If $SBNM Select Case $SBNM="255.255.255.0" Goto Oneseg Case $SBNM="255.255.255.128" Goto Halfseg Case $SBNM="255.255.255.192" Goto Quadseg Case $SBNM="255.255.255.224" Goto 252 EndSelect Endif :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 HSRP default gateway should be the following "$NDG ?" Your 2nd HSRP default gateway should be the following "$NDG1 ? " Your Os is "@PRODUCTTYPE ? " The Script will make the changes for you " Select Case $OS_SHORT='WinNT' ; this is where I would like to put in the command to write the NDG and NDG1 into the Windows NT 4 machines network settings case $OS_SHORT='Win2K' ; This is where a Windows 2000 machine would get the NDG and NDG1 written into in network settings area under Default gateway case $OS_SHORT='WinXP' ; This is where we would put the command need to update the machine with the new default gateways. Do you know how to set IP configuration in W2k and Wxp using the Netsh command ?
|