Clean Out Stale RDP Connections


In working with RDP over the past few days, I couldn’t help but notice that a now-retired PC still shows up in the menu of available connections in the Remote Desktop Connection application. Here’s what I see when I use that tool to show me all known connections:

I gave the XPS 2720 away about ten days ago, so there’s no reason for it to show up in that menu anymore. Would that one could just right-click the entry and select delete or remove to make it go away. But instead, a pair of registry edits is required.

Registry Edits For Cleaning Up Stale RDP Connections

Both sub-keys to edit reside in the following registry key:

HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client

Key 1 is named default and keeps track of the last 10 RDP connections made. If you look at this listing, you’ll see that MRU (most recently used) entry 5 (MRU5) corresponds to the XPS 2720.

Key 2 is named Servers, and has a set of sub-keys for each named machine to which RDP has connected since the last clean-up:

Doing the Cleanup

You can’t get rid of individual MRUs by deleting them. You can, however, edit their contents to rename them (I changed the XPS 2720 entry to Retired, for example). Otherwise, you must simply delete the entire MRU cache (Entries named MRU0 through MRU9) and delete it en masse to make the old ones go away. Within the Servers key, select the subfolders/subkeys for entries you wish to delete and they will be removed. Right-click them one at a time, then select delete from the resulting pop-up menu. I used this technique to remove ed-i7pc, etprodpc and gregpry-xps27 to produce this listing:
Now, it shows only actual RDP hosts to which I might actually connect. And if I look at the pulldown in the RDC application, the entry that used to read “gregpry-xps27” now reads “Retired.” I decided I wanted to keep my MRU data because I’m still using the vast majority of remaining entries. You can manage this stuff however you like.

The Usual Registry Edit Disclaimer

Editing the registry can be a dangerous business. Adding, removing, or changing the wrong keys can result in an inoperative or severely damaged Windows 10 installation. I make an image backup every morning for my work PCs. If you don’t already have a current backup before you venture into the Registry Editor, do yourself a favor and make one before you start. That way, if anything should go amiss, you can restore things to normal operation pretty quickly and easily anyway.

Author: Ed Tittel

Ed Tittel is a 30-plus-year computer industry veteran. He’s a Princeton and multiple University of Texas graduate who’s worked in IT since 1981 when he started his first programming job. Over the past three decades he’s also worked as a manager, technical evangelist, consultant, trainer, and an expert witness. See his professional bio for all the details.