其实之前有折腾过过几次,但均以失败告终,要么就是通过exe才能开启,但是考虑到安全问题,我更倾向于逐项修改系统参数来实现。
将下方的代码保存成reg格式,再执行,根据你的要求,修改相应端口:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server]
"fDenyTSConnections"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp]
"PortNumber"=dword:00003039
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp]
"PortNumber"=dword:00003039
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp]
"UserAuthentication"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules]
"{33893389-3389-3389-3389-338933893389}"="v2.10|Action=Allow|Active=TRUE|Dir=In|Protocol=6|LPort=12345|Name=12345|"