在论坛找了一段代码,
$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
但由于代码不完整,其中有些参数如 $Return 不知道是什么意思,也不知如何使用
请帮忙修改完整
[ 本帖最后由 新手上路 于 2008-12-13 21:21 编辑 ] |