Session has been disconnected reason code 0, 2, 5, 11, 12
A typical Event ID you may see when checking RDP connection event logs is Event ID 40. Event ID 40 is registered whenever a session is disconnected, that could be an interruption or the user disconnecting or logging off. Within the event text, we are given a reason code, which gives us detail on the disconnection, as shown in the following picture.
Most often, you’ll see the full error message Session has been disconnected, reason code 0/2/5/11/12. There are definitions for all codes:
- Code 0 means that there is simply no additional information available for the disconnection.
- Code 2 is similar to code 11; it is logged when an administrative tool was used to disconnect the session from another session.
- Code 5 is generated when a user connects to the device using the same login but the system does not enable multiple concurrent sessions, causing another current connection to be disconnected.
- Code 11 is registered when the user disconnecting from the session initiates the disconnection. This might be due to the user shutting the RDP window or to the usage of an administrative tool from the same session, such as the logoff command in CMD or a batch file, to force the disconnect.
- Code 12 is registered when the disconnection was initiated by the user logging off their session on the machine.
Six solutions to fix the RDP session disconnection
Here are six solutions to help you fix the RDP session disconnection problem. If you are facing Session has been disconnected, reason code 12 or Session 2 has been disconnected, reason code 5, try the solutions below.
Solution 1. Ping the server IP Address via CMD
Some users reflected that the RDP session disconnection problem happens when the remote session is dropped to the taskbar and another program becomes the primary application used while RDP is running in the background. Therefore, users can ping their IP addresses via CMD to keep the remote session active even if it is minimized.
Step 1. Press Win + R to invoke the Run dialog box. Type in “cmd” and hit OK to open Command Prompt.
Step 2. Enter the command “ping -t SERVER_IP”. (Replace SERVER_IP with your IP Address)
Note: If you don’t know how to get the IP Address, press Win + R to invoke the Run dialog box. Type in “cmd” and press OK. Then type in “ipconfig” and press Enter. Now you can see a group of IP addresses, of which the IPv4 address is the one you need.
Solution 2. Checkthe Registry Editor
Another solution to troubleshoot RDP session disconnection is to check the Registry settings.
Step 1. Press Win + R and then type in “regedit” to open the Registry Editor.
Step 2. Navigate here: HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > TermService. Find and double-click ObjectName.
Step 3. Input the Value data as NT Authority\NetworkService. Then click OK.
Solution 3. Check the Local Group Policy
According to some users, RDP session disconnection may also be caused by the session time limit setting. Users can change the settings to configure a time limit for RDP session timeout.
Step 1. Press Win + R to invoke the Run dialog box. Type in “gpedit.msc” and hit OK to open Registry Editor.
Step 2. Navigate here: Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Session Time Limits. Find “Set time limit for disconnected session” and “Sets a time limit for active but idle Terminal Services sessions” on the right pane.
Step 3. Enable “Set time limit for disconnected session” to Never, and then enable “Sets a time limit for active but idle Terminal Services sessions” to Never.
Solution 4. Change the device settings used for the remote session
It has been tested by some users that unselecting the option Smart cards or Windows Hello for Business helps troubleshoot the RDP session disconnection problem.
Step 1. Search for Remote Desktop Connection in the search box and then start RDP. Select More Options.
Step 2. Switch to Local Resources and then click More.
Step 3. Find the option Smart cards or Windows Hello for Business and then unselect it.
Solution 5. Verify RDP limit number of connections policy
Sometimes, when the number of RDP sessions that can be active on a server is exceeded, users may experience RDP session disconnection. Therefore, users can follow the steps below to verify and change the number of connections that they want to allow.
Step 1. Open the Local Group Policy.
Step 2. Navigate here: Local Computer Policy > Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Connections. Find Limit number of connections.
Step 3. Click Enabled. In the RD Maximum Connections allowed box, type the maximum number of connections that you want to allow, and then click OK.
Solution 6. Disable restriction on simultaneous RDP sessions
Additionally, you may utilize Remote Desktop Services to modify Group Policy so that users are permitted to make multiple simultaneous remote connections. Additionally, this could assist in resolving the disconnect issue brought on by the quantity of Remote Desktop sessions.
Step 1. Open the Local Group Policy.
Step 2. Navigate here: Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Connections. On the right pane, find Restrict Remote Desktop Services users to a single Remote Desktop Services session and double-click it.
Step 3. Then disable the policy setting.
Note: Normally, Windows OS only allows one simultaneous incoming RDP connection and Windows Server OS allows two. If you want to enable more remote desktop connections, please buy RDS CALs.
Bonus tip: Stable remote access software-AnyViewer
We sincerely hope you can solve Session has been disconnected reason code error with the solutions we give. But if still not, you are highly recommended to use AnyViewer, a free yet stable remote access software that allows you to remotely access another PC. With AnyViewer, you don’t need to worry about the remote session disconnection problem anymore.
Step 1. On both computers, download, install, and launch AnyViewer. Go to Log in on the Controller computer, and then click Sign up (if you have already signed up on its official website, you can log in directly).
Step 2. Fill out the signup form.
Step 3. You should now see that you have successfully logged into AnyViewer. Your device will be assigned to the account to which you have logged in automatically.
Step 4. Sign in with the same AnyViewer account on both computers, then click the One-click control for unattended remote access.
Step 5. The remote desktop will appear once the connection is established. After that, you have complete control over it.
- It is recommended to upgrade your account to a Professional or Enterprise plan. What can a professional or enterprise plan brings to you:
- More devices can be assigned to the same account for unattended remote support.
- Connect in privacy mode to protect your privacy. This means the Controller can black out the remote PC screen and disable the remote keyboard and mouse click.
- File transfer speed will be increased. Transfer speed is 500 KB/s for a free account and up to 10 MB/s for a paid account.
This post primarily introduces what does “Session has been disconnected reason code0/2/5/11/12” error message means and how to fix RDP session disconnection. If you want a more stable remote access tool, try AnyViewer.