Dim DNS1:DNS1 = "1.1.1.1" '//主DNS
Dim DNS2:DNS2 = "2.2.2.2" '//次DNS
strWinMgmt="winmgmts:{impersonationLevel=impersonate}"
Set SAWXY_NICS = GetObject( strWinMgmt ).InstancesOf("Win32_NetworkAdapterConfiguration")
For Each SAWXY_NIC In SAWXY_NICS
IF SAWXY_NIC.IPEnabled Then
SAWXY_NIC.SetDNSServerSearchOrder Array(DNS1,DNS2)
End IF
Next
把以上内容复制到*.TXT的文档里面,之后把TXT的后缀改为vbs。(把红色字体改为你要用的NDS)
转载于:https://blog.51cto.com/hfzhang/1243601