找回密码
 加入
搜索
查看: 1785|回复: 3

[AU3基础] Wmi转换

[复制链接]
发表于 2011-5-26 11:54:54 | 显示全部楼层 |阅读模式
以下是一段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
发表于 2011-5-26 15:50:35 | 显示全部楼层
期待高手的解答。。顶起。。
 楼主| 发表于 2011-5-26 19:30:36 | 显示全部楼层
呵呵,我也顶一下.希望能有人能解答.
发表于 2011-6-9 00:38:21 | 显示全部楼层
加点变量符号试着改。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-21 05:50 , Processed in 0.073483 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表