适用于:Windows 10、Windows 8.1、Windows 8、Windows Server 2019、Windows Server 2016、Windows Server 2012 R2、Windows Server 2008 R2
管理员启动Powershell
查看当前RDP端口
Get-ItemProperty -Path 'HKLM:SYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp' -name "PortNumber"
修改当前RDP端口为3390
Set-ItemProperty -Path 'HKLM:SYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp' -name "PortNumber" -Value 3390(新RDP端口)
New-NetFirewallRule -DisplayName 'RDPPORTLatest' -Profile 'Public' -Direction Inbound -Action Allow -Protocol TCP -LocalPort 3390(新RDP端口)
在防火墙设置新端口进站
netsh advfirewall firewall add rule name = RDP新端口 dir = in protocol = tcp action = allow localport = 新端口 remoteip = localsubnet profile =any