TightVNC 借用 3389 端口

在部分办公室网络存在网络限制而不能正常使用 VNC 的情况下,通过占用 RDP 端口来实现 VNC 访问。

停用 3389 端口

# 关闭远程桌面功能
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name 'fDenyTSConnections' -Value 1
# 禁用防火墙规则
Disable-NetFirewallRule -DisplayGroup "Remote Desktop"
# 确保停止远程桌面服务
Stop-Service -Name TermService -Force
Set-Service -Name TermService -StartupType Disabled

防火墙规则禁用可能会报错,忽略即可。通过运行 netstat -ano | findstr 3389 确保端口已经没有被监听,然后去安装 VNC,并绑定端口到 3389。

恢复

Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name 'fDenyTSConnections' -Value 0
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
Set-Service -Name TermService -StartupType Automatic
Start-Service -Name TermService

Comments