In my lab I have quite a few machines I remote into on a daily basis, but one of them, connected to the same network switch, would at times disconnect me several times per hour. Sometimes the session reconnected itself, sometimes I had to close the initial connection, and connect again.
Researching the problem
After a bit of troubleshooting, I stumbled across these articles
Troubleshoot Remote desktop disconnected errors
https://learn.microsoft.com/en-us/troubleshoot/windows-server/remote/troubleshoot-remote-desktop-disconnected-errors
Remote Desktop Client Troubleshooting: Disconnect Codes and Reasons
https://social.technet.microsoft.com/wiki/contents/articles/37870.remote-desktop-client-troubleshooting-disconnect-codes-and-reasons.aspx
This led me to check the Microsoft-Windows-TerminalServices-RDPClient/Operational event logs on the device I was connecting from, more specifically event id 1026 which shows the disconnected reason. You this event log in the Microsoft / Windows / TerminalServices-ClientActiveXCore node in the Event Viewer.
In my event log I had disconnected reason code 2308 that matched the times I've been disconnected, and that indicates network connectivity issues. That seemed odd since I could connect to other machines on the same network just fine, but it led me to try changing the protocols used to connect to the machine.
The Solution
The RDP transport protocols are on the remote PC are defined in the Select RDP transport protocols group policy that you find in the Computer Configuration / Administratives Templates / Windows Components / Remote Desktop Services / Remote Desktop Session Host / Connections node.
After changing this policy from the default (Use either UDP and TCP) to Use both UDP and TCP, my disconnection problem went away.
