屏蔽端口的vbs腳本
更新時(shí)間:2010年04月17日 11:52:10 作者:
有時(shí)候服務(wù)器為了安全只允許訪問的端口加到TCP/IP篩選里面,其它的端口將無法訪問。這里的代碼就是為了這樣的功能實(shí)現(xiàn)。
復(fù)制代碼 代碼如下:
'On Error Resume Next
Const ALLOW_ALL = 0
Port = Array("4900", "5000", "5100", "5500", "5600", "6000", "7000", "7100", "7200", "7300", "7400","3389","80")
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetCards = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each objNetCard In colNetCards
arrPermittedTCPPorts = Port
arrPermittedUDPPorts = Array(ALLOW_ALL)
arrPermittedIPProtocols = Array(ALLOW_ALL)
objNetCard.EnableIPSec arrPermittedTCPPorts, arrPermittedUDPPorts, arrPermittedIPProtocols
Next
執(zhí)行以后,到
網(wǎng)上鄰居--》右鍵--》屬性--》本地連接--》常規(guī)--》Internet 協(xié)議(TCP/IP)-->屬性--》高級--》選項(xiàng)--》TCP/IP篩選--》屬性--》只允許 里面即可看到如下圖。

上面的代碼只是個(gè)例子,服務(wù)器上不要運(yùn)行啊,如果要設(shè)置服務(wù)器,請到腳本之家服務(wù)器軟件下載中心,查看相關(guān)教材。
您可能感興趣的文章:
- javascript屏蔽右鍵代碼
- jquery禁用右鍵單擊功能屏蔽F5刷新
- 屏蔽網(wǎng)頁右鍵復(fù)制和ctrl+c復(fù)制的js代碼
- 屏蔽Flash右鍵信息的js代碼
- 網(wǎng)頁屏蔽(左右鍵,代碼等)的非JS方法
- vbs之使用Internet Explorer 屏蔽密碼
- vbs屏蔽鍵盤按鍵
- VB使用XMLHTTP實(shí)現(xiàn)Post與Get的方法
- VB讀取線程、句柄及寫入內(nèi)存的API代碼實(shí)例
- VB實(shí)現(xiàn)的倒計(jì)時(shí)類代碼詳解
- VB調(diào)用Word拼寫檢查功能實(shí)例
- VB實(shí)現(xiàn)屏蔽文本框右鍵菜單的復(fù)制、粘貼等功能的方法
相關(guān)文章
VBS InternetExplorer.Application的屬性和方法介紹
V這篇文章主要是介紹vBS InternetExplorer.Application 屬性和方法,需要的朋友可以參考一下2009-07-07VBS教程:VBscript屬性-FirstIndex 屬性
VBS教程:VBscript屬性-FirstIndex 屬性...2006-11-11