修改Windows 2003/2008/2012远程桌面服务端口号
下面代码保存 .bat 格式即可
@echo off
color 0a
title 修改Windows 2003/2008远程桌面服务端口号
echo *******************************************************************
echo * 请输入您要更改的远程桌面端口号,范围:1024-65535,不能与其他端口冲突*
echo *******************************************************************
echo.
set /p port=请输入端口:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v PortNumber /t reg_dword /d %port% /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t reg_dword /d %port% /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 %port% remote enable
echo.
echo *******************************
echo * 重新启动远程桌面*
echo *******************************
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.
echo 下面开始重新启动电脑以生效,请选择启动方式:
echo 选择1手动重新启动
echo 选择2自动重新启动
set /p select=请您选择1,2:
if "%select%"=="1" goto A
if "%select%"=="2" goto B
pause
exit
:A
echo 退出,请手动重新启动电脑
pause
exit
:B
shutdown -r -t 1
pause
exit
定,精,简,俭