命令更改win远程桌面端口

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

管理员运行powershell

修改端口

$portvalue = 6666

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
图片[1]-命令更改win远程桌面端口-云计算运维

查看端口

Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber"
图片[2]-命令更改win远程桌面端口-云计算运维

重启远程桌面服务使更改生效

net stop TermService
net start TermService
© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享