Tony
2009-04-06, 02:23 PM
192.168.0.1 为网关
202.96.134.133为首选DNS
202.96.128.68为备用DNS
把下面内容保存为"VBS"格式即可
Const STR_GATEWAY = "192.168.0.1"
Const STR_NEWDNS1 = "202.96.134.133"
Const STR_NEWDNS2 = "202.96.128.68"
Set fs=CreateObject("Scripting.FileSystemObject")
strWinMgmt="winmgmts:{impersonationLevel=impersonate}"
Set objNICs = GetObject( strWinMgmt ).InstancesOf("Win32_NetworkAdapterConfiguration")
For Each objNIC In objNICs
If objNIC.IPEnabled Then
objNIC.SetDNSServerSearchOrder Array(STR_NEWDNS1,STR_NEWDNS2)
objNIC.SetGateways Array(STR_GATEWAY)
End If
Next
202.96.134.133为首选DNS
202.96.128.68为备用DNS
把下面内容保存为"VBS"格式即可
Const STR_GATEWAY = "192.168.0.1"
Const STR_NEWDNS1 = "202.96.134.133"
Const STR_NEWDNS2 = "202.96.128.68"
Set fs=CreateObject("Scripting.FileSystemObject")
strWinMgmt="winmgmts:{impersonationLevel=impersonate}"
Set objNICs = GetObject( strWinMgmt ).InstancesOf("Win32_NetworkAdapterConfiguration")
For Each objNIC In objNICs
If objNIC.IPEnabled Then
objNIC.SetDNSServerSearchOrder Array(STR_NEWDNS1,STR_NEWDNS2)
objNIC.SetGateways Array(STR_GATEWAY)
End If
Next