|
#NoTrayIcon
#include <Array.au3>
Global $wbemFlagReturnImmediately = 0x10
Global $wbemFlagForwardOnly = 0x20
Global $strComputer = "localhost"
Global $colItems = ""
Local $DNS[2]
$DNS[0] = "61.177.7.1"
$DNS[1] = "221.228.255.1"
_DNS($DNS[0], $DNS[1])
Func _DNS($DNS1, $DNS2)
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled =TRUE", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
$DNS = _ArrayCreate($DNS1, $DNS2)
If IsObj($colItems) Then
For $objItem In $colItems
$strDNSServerSearchOrder = $objItem.SetDNSServerSearchOrder ($DNS)
Next
Else
MsgBox(0, "WMI Output", "No WMI Objects Found for class: " & "Win32_NetworkAdapterConfiguration")
EndIf
EndFunc ;==>_DNS |
|