Troubleshoot and Improve RDP Connections with UDP

The new norm of work from home during COVID isn’t always pretty. The truth is, for many, we rely on infrastructures that aren’t built for a 24/7 remote work environment. One of the core technology people are relying on those days is Microsoft’s RDP protocol.

Window’s Remote Desktop has always based on local connections. Almost all of us that use RDP to remote into our workstation or work environments require some sort of VPN before making the RDP connection. The stability of RDP thus depends on two factors your VPN connection as well as your RDP connection. Today we will explore how you can troubleshoot RDP and potentially improve your RDP connection so you can have better work from home experience. This is a must-read if you are currently experiencing RDP lag, sluggish connections or random RDP drop throughout your day.

Troubleshoot

Here are a few troubleshooting commands you can run on both your home and remote workstation and compare some results.

[System.Environment]::OSVersion.Version

Get-ItemProperty -Path 'HKLM:/Software/Policies/Microsoft/Windows NT/Terminal Services/Client'

Get-NetFirewallRule -DisplayName "Remote Desktop - User Mode*" | ft Displayname,Enabled

This checks your current host Windows version. This will provide a good basis on how compatible between your host and remote are. Ideally you want to say on the same version as close as possible.

❯ [System.Environment]::OSVersion.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      20201  0

This next command prints out all the services and flags that support remote desktop. Again this can tell you any misalignment in the configuration between the host and the remote.

fEnableUsbBlockDeviceBySetupClass : 1
fEnableUsbNoAckIsochWriteToDevice : 80
fEnableUsbSelectDeviceByInterface : 1
fClientDisableUDP                 : 0
PSPath                            : Microsoft.PowerShell.CoreRegistry::HKEY_LOCAL_MACHINESoftwarePoliciesMicrosoft
                                    Windows NTTerminal ServicesClient
PSParentPath                      : Microsoft.PowerShell.CoreRegistry::HKEY_LOCAL_MACHINESoftwarePoliciesMicrosoft
                                    Windows NTTerminal Services
PSChildName                       : Client
PSDrive                           : HKLM
PSProvider                        : Microsoft.PowerShell.CoreRegistry

Lastly, this command prints out in what TCP/IP stack the RDP protocol is configured to run. This and the above command might yield different results on your machine than what I’m presenting you. Since I’ve already configured to enable UDP with RDP protocol.

DisplayName                         Enabled
-----------                         -------
Remote Desktop - User Mode (TCP-In)    True
Remote Desktop - User Mode (UDP-In)    True

Enable UDP over RDP

One way to improve your RDP connection is to enable UDP instead of relying on just TCP alone. The advantage of enabling UDP is just like you are streaming a YouTube clip any missing or dropped frame does not cause an additional round-trip to try to retry and retrieve it from the server. Enable UDP should always result in a net positive in terms of user experience. To do so you need to run the following power shell commands.

On remote machine (i.e workstation at office)

Enable-NetFirewallRule -DisplayName "Remote Desktop - User Mode (TCP-In)"
Enable-NetFirewallRule -DisplayName "Remote Desktop - User Mode (UDP-In)"

On host machine (i.e home machine or your laptop)

Set-ItemProperty 'HKLM:/Software/Policies/Microsoft/Windows NT/Terminal Services/Client' 'fClientDisableUDP' 0

Now if you restart your RDP connection again and press and click the signal bar on the top left corner of the RDP droplet. You should see the message displays with “and UDP is enabled”. An example of this when you are having an excellent connection would be.

The quality of the connection to the remote computer is excellent and UDP is enabled.

That’s it, now you have both UDP configured to run on your RDP. This will and should help improve any sluggishness you might experience when working heavily under an RDP environment.

The post Troubleshoot and Improve RDP Connections with UDP appeared first on Next of Windows.