我来回复$colItems = ""
$strComputer = "localhost"
$objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration where IPEnabled=TRUE", "WQL", 0x10 + 0x20)
Local $strIPAddress[1] = ["192.168.1.235"]
Local $strSubnetMask[1] = ["255.255.254.0"]
Local $strGateway[1] = ["192.168.1.1"]
Local $dns[2] = ["202.96.128.80", "202.96.128.81"]
For $objItem In $colItems
$objItem.EnableStatic($strIPAddress, $strSubnetMask)
$objItem.SetGateways($strGateway)
$objItem.SetDNSServerSearchOrder($dns)
Next
MsgBox(0,"","完成")
|