修改 Gateway和DNS的vbs脚本
发布时间:2016-12-28 来源:查字典编辑
摘要:复制代码代码如下:ConstT_GATEWAY="1.1.1.1"'网关ConstT_NEWDNS1="2.2.2.2"'DNS1Const...
复制代码 代码如下:
Const T_GATEWAY = "1.1.1.1" '网关
Const T_NEWDNS1 = "2.2.2.2" 'DNS1
Const T_NEWDNS2 = "3.3.3.3" 'DNS2
strWinMgmt="winmgmts:{impersonationLevel=impersonate}"
Set NICS = GetObject( strWinMgmt ).InstancesOf("Win32_NetworkAdapterConfiguration")
For Each NIC In NICS
If NIC.IPEnabled Then
NIC.SetDNSServerSearchOrder Array(T_NEWDNS1,T_NEWDNS2)
NIC.SetGateways Array(T_GATEWAY)
End If
Next
无须重新启动,不管系统语言