娱乐新地带论坛

娱乐新地带论坛 (https://bbs.1819.net/index.php)
-   『软件使用』 (https://bbs.1819.net/forumdisplay.php?f=11)
-   -   vbs批量换DNS跟网关 (https://bbs.1819.net/showthread.php?t=67210)

Tony 2009-04-06 02:23 PM

vbs批量换DNS跟网关
 
192.168.0.1 为网关
202.96.134.133为首选DNS
202.96.128.68为备用DNS
把下面内容保存为"VBS"格式即可
PHP 代码:

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 GetObjectstrWinMgmt ).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 



所有时间均为北京时间。现在的时间是 06:08 AM

©2003-2024 1819.net All rights reserved. © 2024