'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
执行以后,到
网上邻居--》右键--》属性--》本地连接--》常规--》Internet 协议(TCP/IP)-->属性--》高级--》选项--》TCP/IP筛选--》属性--》只允许 里面即可看到如下图。
上面的代码只是个例子,服务器上不要运行啊,如果要设置服务器,请到
脚本之家服务器软件下载中心,查看相关教材。