Powershell 更改计算机上的远程桌面的RDP端口
适用于: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:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber"
修改当前RDP端口为3390
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-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
posted on 2021-01-07 22:15 stoneyeung 阅读(576) 评论(0) 编辑 收藏 举报