windows快速修改远程桌面端口
这是一个powershell脚本,设置端口变量的端口侯,执行脚本,即可更改本机的mstsc端口
$portvalue = 53892
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber" -Value $portvalue
New-NetFirewallRule -DisplayName 'RDPPORTLatest-TCP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol TCP -LocalPort $portvalue
New-NetFirewallRule -DisplayName 'RDPPORTLatest-UDP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol UDP -LocalPort $portvalue
修改后需要根据网络情况打开防火墙端口,根据网络是在域,专用,公用,打开端口。