|
以下是一段vbs更改网关的wmi代码.请会的兄弟帮忙转换为au3代码.
DefaultIPGateway1=Array("192.168.1.1")
ComputerName="."
Dim objWMIService,colItems,objItem,objAddress
Set objWMIService = GetObject("winmgmts:\\" & ComputerName & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each objItem in colItems
objItem.SetGateways(DefaultIPGateway1)
Next
我试过这样转换却报错,不成功!
$getaway = "192.168.1.2"
$ComputerName = "."
Dim $objWMIService, $colItems, $objItem, $objAddress
$objWMIService = ObjGet("winmgmts:\\" & $ComputerName & "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For $objItem In $colItems
$objItem.SetGateways($getaway)
Next |
|