请教WMI达人,多网卡改IP
$strComputer = "localhost"$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")
$colNetAdapters = $objWMIService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
If IsObj($colNetAdapters) Then
For $objNetAdapter in $colNetAdapters
If BitAND($Return, 1) = 0 AND BitAND($Return, 2) = 0 Then $objNetAdapter.EnableStatic($LocalIPAddress, $strSubnetMask)
If BitAND($Return, 4) = 0 Then $objNetAdapter.SetGateways($strGateway, $strGatewayMetric)
Next
EndIf
改单个网卡的IP大概是这样,但是如果机子有多个网卡,用AU3调用WMI的话,咋样设置指定网卡的IP呢?请高手赐教!! GOOKER版主,咋移动"已解决"了?但是还没人回答我问题啊,至少帮忙给个说明啊!表笑我菜了! $strComputer = "localhost"
$sDescription = "网卡名称"
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")
$colNetAdapters = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE Description = '" & $sDescription & "'", "WQL", 0x10 + 0x20)
If IsObj($colNetAdapters) Then
For $objNetAdapter in $colNetAdapters
If BitAND($Return, 1) = 0 AND BitAND($Return, 2) = 0 Then $objNetAdapter.EnableStatic($LocalIPAddress, $strSubnetMask)
If BitAND($Return, 4) = 0 Then $objNetAdapter.SetGateways($strGateway, $strGatewayMetric)
Next
EndIf 学习学习中, 学习一下。。 WMI看不太明白。。。 刚来学习的有些看不懂... 楼主分享下经验哈 学习 学习
页:
[1]