远程桌面(Remote Desktop)是Windows中的一种软件,可让您连接到不在附近的计算机。当您尝试使用远程桌面(Remote Desktop)连接到远程计算机时,您可能会收到以下错误消息:
远程桌面无法连接到远程计算机。连接被远程计算机拒绝。
- 未启用对服务器的远程访问
- 远程计算机已关闭
- 远程计算机在网络上不可用
确保(Make)远程计算机已打开并连接到网络,并且启用了远程访问。
可能有多种原因,包括权限、网络、组策略等。您的帐户没有足够权限的常见原因之一。有时计算机无法从源计算机启动连接。这篇文章将指导您如何解决问题。
远程桌面无法连接到远程计算机
依次遵循这些建议,并检查问题是否再次出现。
- 检查远程计算机上RDP协议的状态(RDP)
- 检查(Check)组策略对象(Group Policy Object)( GPO )是否阻止本地计算机上的RDP
- 检查RDP服务的状态
- 检查另一个应用程序是否没有尝试使用相同的端口
- 检查(Check)防火墙是否阻止了RDP端口
- 检查 RDP 侦听器端口
- 检查RDP侦听器的状态
您将需要其中一些管理员权限。
1]检查(Check)远程计算机上RDP协议的状态
RDP 协议(RDP Protocol)有一个注册表项,允许您启用RDP 协议(RDP Protocol),这对于远程桌面(Remote Desktop)应用程序建立连接很重要。在进行任何更改之前,请务必备份注册表。(a backup of the registry)
(Type Regedit)在运行(Run)提示符 ( Win +R键入 Regedit,然后按Enter键。然后导航到以下路径。
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server.
双击 DWORD fDenyTSConnections并将值更改为0以启用 RDP(enable RDP)。
2]检查(Check)组策略对象(Group Policy Object)( GPO )是否阻止本地计算机上的RDP
打开组策略编辑器(Group Policy Editor)并导航到以下路径
Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Connections
查找具有名称的策略 -允许用户使用远程桌面服务进行远程连接(Allow users to connect remotely by using Remote Desktop Services)。请将其设置为Enabled。
在受影响的计算机上,以管理员身份打开命令提示符窗口,然后运行 gpupdate /force
命令。
相关(Related): 远程桌面找不到电脑(Remote Desktop can’t find the computer)。
3]检查(Check)RDP服务的状态
与RDP(RDP)相关的服务应该在客户端和远程计算机上运行。主要服务是——
- 远程桌面服务(Remote Desktop Services)( TermService ) 和
- 远程桌面服务用户模式端口重定向器(Remote Desktop Services UserMode Port Redirector)( UmRdpService )。
在运行(Run)提示中键入服务,然后按(services)Enter键。
在服务面板中,找到这两个服务,并确保它们正在运行。将它们设置为与计算机一起自动重新启动。
4]检查(Check)另一个应用程序是否没有尝试使用相同的端口
RDP使用端口号 3389,如果任何其他应用程序正在使用它,您将无法连接。
在提升的PowerShell(PowerShell)上运行以下命令
cmd /c netstat -ano
找到(Locate)引用为 3389 的任何内容,然后注意进程的PID。
打开任务管理器(Task Manager),然后右键单击任何列以选择PID。找到与我们使用命令找到的具有相同PID的进程。
如果它不是Remote Desktop,那么您有以下选项:
- 更改远程桌面的端口。
- 使用该端口卸载或禁用应用程序
- 将应用程序使用的端口更改为其他端口。
确保(Make)完成后重新启动RDP服务。
相关(Related):远程桌面连接 在 Windows 10 中不起作用。(Remote Desktop Connection not working)
5]检查(Check)防火墙是否阻塞了RDP端口
Sysinternals 提供了一个PS Ping 工具(PS Ping Tool)来检查您是否可以通过端口访问计算机。它还用于检查任何计算机上的开放端口列表。
- 从 Sysinternals(from Sysinternals)下载 PSPING 工具。
- 打开命令提示符
- 然后导航到您下载文件的文件夹。
- 执行以下命令
psping -accepteula <computer IP>:3389
如果结果显示远程计算机拒绝连接或所有尝试连接都失败,那么您需要检查该端口是否已在计算机上被阻止。
按照我们详尽的指南检查防火墙上的端口限制(check port restrictions on the Firewall)以删除任何防火墙。
6]检查RDP侦听器端口
RDP使用端口(Port)号 3389,如果未建立连接,请确保检查它们在两台计算机上的配置是否正确。在这里我们将修改注册表,所以一定要备份。
- (Type)在运行提示中(Run)键入regedit ,然后按Enter键。
- 导航到以下路径
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
- 找到PortNumber ( DWORD ),然后双击并确保值为3389
- 重新启动远程桌面服务。
- 检查您是否可以连接到远程计算机。
确保(Make)在两台计算机上执行相同的步骤。
疑难解答(Troubleshoot):Windows 上的远程桌面连接问题(Remote Desktop connection issues on Windows)。
7]用另一台计算机注册表更新(Update)
如果您有另一台计算机可以使用远程连接进行连接,您可以选择导出RDP的注册表项并在它不工作的地方导入。
按照远程连接正在工作的这个:(Follow this on which the remote connection is working:)
打开注册表(Registry)编辑器,然后导航到以下路径:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
右键单击RDP-Tcp密钥并选择导出。它将携带密钥内的所有设置。
在远程连接不起作用的情况下执行此操作:(Follow this on which the remote connection is not working:)
- 复制上述方法导出的文件,并保存在桌面上。
- 接下来,打开注册表(Registry)编辑器,然后单击File > Import
- 选择导出的文件
- 系统将提示您合并或覆盖,批准它。
完成后,检查您是否能够通过远程桌面应用程序进行连接。
我希望您能够解决远程(Remote)桌面无法连接到远程计算机的问题。确保(Make)在进行任何更改之前始终备份计算机和注册表。
Remote desktop can’t connect to the remote computer on Windows 11/10
Remote Desktop is a software in Windows that allows you to connect to a computer that is not close by. When you try to connect to a remote computer by using Remote Desktop, you may receive the following error message:
Remote desktop can’t connect to the remote computer. The connection was rejected by the remote computer.
- Remote access to the server is not enabled
- The remote computer is turned off
- The remote computer is not available on the network
Make sure the remote computer is turned on and connected to the network, and that remote access is enabled.
There can be multiple reasons, including permission, network, group policy, and more. One of the common reasons when your account does not have enough permission. At times the computer is not able to initiate the connection from the source computer. This post will guide you on how you can fix the problem.
Remote desktop can’t connect to the remote computer
Follow these suggestions one after the other, and check if the issue reappears.
- Check the status of the RDP protocol on a remote computer
- Check whether a Group Policy Object (GPO) is blocking RDP on a local computer
- Check the status of the RDP services
- Check that another application isn’t trying to use the same port
- Check whether a firewall is blocking the RDP port
- Check the RDP listener port
- Check the status of the RDP listener
You will need admin privilege for some of these.
1] Check the status of the RDP protocol on a remote computer
RDP Protocol has a registry entry that allows you to enable RDP Protocol which is important for the Remote Desktop app to make a connection. Do make sure to take a backup of the registry before making any change.
Type Regedit in the Run prompt (Win +R), and press the Enter key. Then navigate to the following path.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server.
Double click on the DWORD fDenyTSConnections and change the value to 0 to enable RDP.
2] Check whether a Group Policy Object (GPO) is blocking RDP on a local computer
Open Group Policy Editor and navigate to the following path
Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Connections
Find the policy with name— Allow users to connect remotely by using Remote Desktop Services. Please set it to Enabled.
On the affected computers, open a command prompt window as an administrator, and run the gpupdate /force
command.
Related: Remote Desktop can’t find the computer.
3] Check the status of the RDP services
Services related to RDP should be running on both client and remote computers. The primary services are—
- Remote Desktop Services (TermService) and
- Remote Desktop Services UserMode Port Redirector (UmRdpService).
Type services in the Run prompt followed by the Enter key.
In the services panel, locate both of these services, and make sure they are running. Set them to restart along with the computer automatically.
4] Check that another application isn’t trying to use the same port
RDP uses port no 3389, and if any other application is using it, you will not be able to connect.
Run the following command on elevated PowerShell
cmd /c netstat -ano
Locate anything which has a reference of 3389, and then notice the PID of the process.
Open Task Manager, and right-click on any of the columns to select PID. Locate the process which has the same PID which we found using the command.
If its anything other than Remote Desktop, then you have the following options:
- Change the port of Remote Desktop.
- Uninstall or Disable the application using that port
- Change the port used by the application to something else.
Make sure to restart RDP services once done.
Related: Remote Desktop Connection not working in Windows 10.
5] Check whether a firewall is blocking the RDP port
Sysinternals offer a PS Ping Tool to check if you can reach a com[puter through a port. It is also used to check a list of open ports on any computer.
- Download the PSPING tool from Sysinternals.
- Open the command prompt
- Then navigate to the folder where you downloaded the file.
- Execute the following command
psping -accepteula <computer IP>:3389
If the result says that the remote computer has refused connection or all attempts to connect failed, then you need to check if the port has been blocked at the computer.
Follow our exhaustive guide to check port restrictions on the Firewall to remove any firewall.
6] Check the RDP listener port
RDP uses Port number 3389, and if the connection is not getting established, make sure to check they are configured correctly on both the computer. Here we will modify the registry, so make sure to take a backup.
- Type regedit in the Run prompt, and then press the Enter key.
- Navigate to the following path
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
- Locate PortNumber (DWORD), and double click and make sure the value is 3389
- Restart Remote Desktop services.
- Check if you can connect to the remote computer.
Make sure to follow the same steps on both computers.
Troubleshoot: Remote Desktop connection issues on Windows.
7] Update with another computer registry
If you have another computer to or from which you can connect using a remote connection, you can choose to export registry keys of the RDP and import where it is not working.
Follow this on which the remote connection is working:
Open Registry editor, and navigate to the following path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
Right-click on RDP-Tcp keys and choose to export. It will carry all the settings inside the key.
Follow this on which the remote connection is not working:
- Copy the exported file from the above method, and keep it on the desktop.
- Next, open the Registry editor, and click on File > Import
- Select the exported file
- You will be prompted about the merger or overwrite, approve it.
Having done that, check if you are able to connect through the remote desktop app.
I hope you were able to resolve the Remote desktop can’t connect to the remote computer problem. Make sure to always back up the computer and the registry before making any change.