更改windows 远程桌面端口 和 解决画面卡顿或卡死问题

尝试用远程桌面,跨网域公网连接。还遇到了连上后卡顿,画面卡死,还不如向日葵快。。。结果发现是公网的udp丢包严重,而这个远程桌面又会自动udp连接。得手动改为tcp连接,画面才变得流畅。。。

一个脚本解决,需要 powershell 管理员权限

ps1 复制代码
# 想要新远程桌面端口,默认是3389,我设定为16251
$portvalue = 16251

# 设定注册表,修改远程桌面端口号
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber" -Value $portvalue 

# 删除之前定的同名防火墙规则,如果有的话
Remove-NetFirewallRule -DisplayName 'RDPPORTLatest-TCP-In'
Remove-NetFirewallRule -DisplayName 'RDPPORTLatest-UDP-In'

# 设定防火墙 允许远程桌面使用 新的端口连接
# 必须设定防火墙允许规则,不然新端口连不上。当然关掉防火墙也可行。
New-NetFirewallRule -DisplayName 'RDPPORTLatest-TCP-In' -Profile 'Any' -Direction Inbound -Action Allow -Protocol TCP -LocalPort $portvalue 
New-NetFirewallRule -DisplayName 'RDPPORTLatest-UDP-In' -Profile 'Any' -Direction Inbound -Action Allow -Protocol UDP -LocalPort $portvalue

# 设定注册表,让远程桌面只使用TCP连接,因为公网的UDP丢包率很高,会导致画面卡顿或卡死。
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -name "SelectTransport" -Value 1

参考资料:

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

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

Windows远程桌面连接经常卡死解决办法

https://blog.csdn.net/spidernet/article/details/136008670

选择 RDP 传输协议

https://admx.help/?Category=Windows_10_2016\&Policy=Microsoft.Policies.TerminalServer::TS_SELECT_TRANSPORT\&Language=zh-cn

求助 用win11 24H2 远程桌面卡还容易断线

https://bbs.pcbeta.com/viewthread-2032711-1-1.html

相关推荐
保卫大狮兄10 小时前
2026中小制造企业轻量化ERP选型观察:产供销协同路线、上线周期与ROI分析
windows·microsoft·erp·生产管理
陈工大模型11 小时前
MacOS 跨平台压缩包处理:从编码痛点到工程化落地的完整方案
windows·macos·缓存·电脑·策略模式·c盘清理
凌镜icecraft1 天前
我改文件扩展名的时候那个警告弹窗再也不会弹出来了
windows·c#·wpf·explorer
the3clipse1 天前
Windows 11 26H2 AI 功能使用指南:回顾、单击以执行与实时字幕
人工智能·windows·copilot+ pc·recall 回顾·单击以执行·实时字幕翻译·windows studio
the3clipse1 天前
Windows 11 26H2 账户登录与 Windows Hello 指南:并行验证、增强登录安全与无密码设置
windows·无密码登录·windows hello·增强登录安全性ess·pin与密码区别·动态锁·win11 26h2
承渊政道1 天前
Toonflow AI短剧教程:Windows部署、批量生成与角色一致性
人工智能·windows·cpolar·ai短剧·toonflow
柳鲲鹏3 天前
编译Windows版本的zlib
windows
Name_NaN_None3 天前
安卓手机远程控制电脑方法(Android/Windows) —— 「小白教程」
android·windows·智能手机·电脑·笔记本
宝桥南山4 天前
Visual Studio - 记录一个Visual Studio 2026(Insiders)的更新问题
windows·microsoft·微软·.net·.netcore·visual studio
JosieBook4 天前
【鸿蒙开源】把 Windows 任务栏上的流量表搬到鸿蒙 PC:TrafficMonitor 1.86 的 C++ 内核移植实践
c++·windows·harmonyos