用VBS修改远程桌面3389端口并添加到Windows防火墙的代码
将下面代码存为.vbs,双击运行。然后重启一下系统,就修改了系统的远程桌面的默认的3389端口
'#####################
'vbs修改远程桌面的默认端口,并添加至windows防火墙
'作者51windows.net
'56868为要设置的端口
'#####################
set wshshell = wscript.createobject("wscript.shell")
wshshell.regwrite "hkey_local_machine\system\currentcontrolset\control\terminal server\winstations\rdp-tcp\portnumber",56868,"reg_dword"
wshshell.regwrite "hkey_local_machine\system\currentcontrolset\control\terminal server\wds\rdpwd\tds\tcp\portnumber",56868,"reg_dword"
function addfirewall(name,port,state)
set objfirewall = createobject("hnetcfg.fwmgr")
set objpolicy = objfirewall.localpolicy.currentprofile
set objport = createobject("hnetcfg.fwopenport")
objport.port = port
objport.name = name
objport.enabled = state
set colports = objpolicy.globallyopenports
errreturn = colports.add(objport)
end function
call addfirewall("远程桌面56868",56868,1)
set wshshell = nothing
msgbox "设置成功"
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
-
-
-
用vbs实现文本循环读取
因为测试中需要读取一批url数据进行浏览,其实使用qtp本身的table能实现多种读取方式,但是因为需要tabel是使用excel保存的,在没有...
[阅读全文]
-
-
-
-
-
网友评论