更改计算机上的远程桌面的侦听端口

 
  1. 将以下代码中的3390更为您想要修改的端口,最大为655335;
  2. 将代码在Windows power 中运行。
$portvalue = 3390

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 

 

https://learn.microsoft.com/zh-CN/windows-server/remote/remote-desktop-services/clients/change-listening-port

posted @ 2024-03-26 11:28  article  阅读(12)  评论(0编辑  收藏  举报