I work with windows a lot and have found I had been having connection issues with Remote Desktop on most of my Windows Servers and some Windows 10 Machines. After some research I found that Windows Server version 1809 (2022) and Windows 10 versions 1806 - 21H2, I have had issues with Remote Desktop freezing. I would have several stints where the RDP client froze on my workstation or computer I am remoting in from. This wasn't the only computer that was having an issue. Another user which also had remote desktop on a workstation (for specific reasons) had also been intermittingly been having the same issue. I also found that in some instances AV also causing some issues.
After some testing; I found a way to mostly stop the disconnection and freezing from the Remote Desktop Client and Server by Disabling UDP and using only TCP. To do this we are going to add a registry key and modify a group policy setting. Let's do the registry key entry first.
On your remote desktop client open and type in the following in cmd promt or powershell as administrator
reg add “HKLM\software\policies\microsoft\windows nt\Terminal Services\Client” /v fClientDisableUDP /d 1 /t REG_DWORD
Now group policy.
Run gpedit.msc. then Navigate to Computer Configuration > Administrative templates > Windows components > Remote Desktop Services > Remote Desktop Connection client.
Now that takes care of the remote desktop client. On the Remote Desktop server on the machine you are wanting to connect to go to:
Computer Configuration > Administrative templates > Windows components > Remote Desktop Services > Remote Desktop Session Host.
Select Transport Type -> USE ONLY TCP