修改windows远程桌面连接端口-批处理

发布时间:2021-09-12

  将以下保存为 port.bat服务器

  ------------------------------

  @echo off
color 0a
title 修改Windows 2003/2008远程桌面服务端口号
echo *******************************************************************
echo * 修改远程端口为33899
echo *******************************************************************
echo 正在修改端口为 33899,请稍候
reg add HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp /v PortNumber /t reg_dword /d 33890 /f
reg add HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp /v PortNumber /t reg_dword /d 33890 /f
netsh firewall set opmode mode = enable
netsh firewall set portopening all 80 web enable
netsh firewall set portopening all 3389 remote-pre enable
netsh firewall set portopening all 33890 remote enable
reg add HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server /v fDenyTSConnections /t reg_dword /d 1 /f
reg add HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server /v fDenyTSConnections /t reg_dword /d 0 /f
echo 正在自动重新启动电脑以便端口生效!
shutdown -r -t 1
pause
exit

  -----------------------------------

  

注册即送1000元现金券