I keep getting an error on this script and I cant understand why. The error is: Error in expression.! Line: 29 Sorry for the messy formatting, didnt know how to indent. I know the script doesnt to anything, the next step is to run a shell command. Thanks 1 $lan = 0 2 $wlan = 0 3 $index = 0 4 DIM $gateway[10] 5 6 $strComputer = "." 7 $objWMIService = GetObject("winmgmts:\\"+ $strComputer + "\root\cimv2") 8 $colItems = $objWMIService.ExecQuery("Select * from Win32_IP4RouteTable") 9 For Each $objItem in $colItems 10 ..if [quote] [/quote]instr($objItem.Destination, "0.0.0.0") 11 ....; test for wired route 12 ....if instr($objItem.NextHop, "172.28")=1 OR instr($objItem.NextHop, "192.198.7")=1 13 ......$lan = 1 14 ....else 15 ......$gateway[$index] = $objItem.NextHop + "," + $objItem.InterfaceIndex 16 ......$index = $index + 1 17 ......$wlan = 1 18 ....endif 19 ..endif 20 Next 21 22 ; test for multiple default gateways 23 if $lan AND $wlan 24 ..;shell command to remove route 25 ..;route delete 0.0.0.0 mask 0.0.0.0 192.168.2.254 if 15 26 ..for each $item in $gateway 27 ....$data[] = split($item,",") 28 ....$route_cmd = "route delete 0.0.0.0 mask 0.0.0.0 " + $data[0] + " if " + $data[1] 29 ..Next 30 endif 31 32 GET$

Attachments
IPRoute.kix (246 downloads)
Description: