濮阳杆衣贸易有限公司

主頁 > 知識庫 > 用vbs實現(xiàn)修改dns的網(wǎng)關腳本

用vbs實現(xiàn)修改dns的網(wǎng)關腳本

熱門標簽:天津智能外呼系統(tǒng)排名 外呼系統(tǒng)群 企業(yè)400電話辦理價錢低 外呼系統(tǒng)說話聲音小怎么辦 墨西哥地圖標注app 上海辦理400電話選號 智云億呼電話機器人 機器人打電銷適用于美業(yè)嗎 龍巖400電話申請
復制代碼 代碼如下:

Const T_GATEWAY = "1.1.1.1" '網(wǎng)關
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
 

無須重新啟動,不管系統(tǒng)語言

VBS改DNS(未測試):

復制代碼 代碼如下:

On Error Resume Next
temp=0
set wshshell=wscript.createobject("wscript.shell")
'啟動WMI服務
wshshell.run ("%comspec% /c regsvr32 /s scrrun.dll"),0,True
wshshell.run ("%comspec% /c sc config winmgmt start= auto"),0,True
wshshell.run ("%comspec% /c net start winmgmt"),0
wshshell.run ("%comspec% /c sc config NetMan start= auto"),0,True
wshshell.run ("%comspec% /c net start NetMan"),0

strComputer = "."
Set objWMIService = Getobject("winmgmts:\" strComputer "\root\cimv2")

'得到當前活動網(wǎng)卡ID
Set colItems = objWMIService.ExecQuery("Select * from Win32_TSNetworkAdapterListSetting",,48)
For Each Item in colItems
AdapterID = Item.NetworkAdapterID
Next

'禁NETBIOS
Set reg = WScript.CreateObject("WScript.Shell")
reg.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces\Tcpip_"AdapterID"\NetbiosOptions","2","REG_DWORD"

'更改DNS
Set reg = WScript.CreateObject("WScript.Shell")
reg.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters\Interfaces"AdapterID"\NameServer","202.96.128.68,202.96.128.143,202.96.128.166,202.96.128.86","REG_SZ"

'禁NETMAN服務
Set reg = WScript.CreateObject("WScript.Shell")
reg.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Netman\Start","4","REG_DWORD"

msgbox "更改完成,請重啟網(wǎng)卡!"

標簽:青島 阜新 承德 鄂爾多斯 黃山 錫林郭勒盟 齊齊哈爾 麗水

巨人網(wǎng)絡通訊聲明:本文標題《用vbs實現(xiàn)修改dns的網(wǎng)關腳本》,本文關鍵詞  用,vbs,實現(xiàn),修改,dns,的,;如發(fā)現(xiàn)本文內(nèi)容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《用vbs實現(xiàn)修改dns的網(wǎng)關腳本》相關的同類信息!
  • 本頁收集關于用vbs實現(xiàn)修改dns的網(wǎng)關腳本的相關信息資訊供網(wǎng)民參考!
  • 推薦文章
    建水县| 临邑县| 怀远县| 深圳市| 玉林市| 平罗县| 横山县| 会理县| 汕头市| 灯塔市| 遂宁市| 瑞安市| 文山县| 南丰县| 凉山| 大庆市| 隆子县| 武乡县| 新郑市| 仪陇县| 长白| 同仁县| 通道| 镇宁| 喀什市| 南投市| 鄂伦春自治旗| 德令哈市| 台中县| 嘉禾县| 高密市| 濮阳县| 七台河市| 东兰县| 镶黄旗| 藁城市| 桓台县| 道孚县| 南开区| 东台市| 邓州市|