• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Tachytelic.net

  • Get in Touch
  • About Me

How to clear RDP Connection History

January 24, 2019 by Paulie 8 Comments

For every successful connection, the RDP client stores the connection details for the machine that you have connected to. This is often convenient, but if you are on a public machine, it can expose sensitive security details. The RDP client does not give any way to clear the cached connection history.

Image of Remote Desktop Client showing connection history

You can clear the RDP Cache history in a couple of ways:

  • Clear the RDP Cache from the registry using regedit
  • Use a script to clear the RDP Cache

Clear the RDP Cache from the registry using regedit

  1. Open regedit.exe and navigate to:
    HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client
  2. There are two registry keys here that need to be cleared:
    • Default – Has the history of the last 10 RDP Connections.
    • Servers – Contains a list of all the Remote Desktop connections that have ever been established from this machine.
  3. Expand the Default Key which will contain the most recently used connections. You can delete every entry or select which ones you want to remove:
  4. Select the entries that you want to remove, right click and click delete:

    Image showing history of RDP connections in the Windows Registry
    Hold shift to select a range, or CTRL to select multiple entries at once.
  5. Now expand the Servers key, this contains the details of all the RDP connections that have ever been made from this machine, including the username used to connect:
    Image showing connection history of RDP client in Windows Registry
  6. There may be many entries, it is easier to delete the entire servers key, then recreate it.
  7. Finally, delete the default.rdp file found in your homepath. This is a hidden file and will not show or delete by default. You have to supply an extra switch to the delete command:

    Image showing correct command line to delete default.rdp from users home directory
    Use command: del /ah %homepath%\documents\default.rdp

Clear the RDP Cache using a batch file or command line

A far quicker way to clear the RDP cache is to use the following commands:

reg delete "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default" /va /f
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Servers" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Servers"
del /ah %homepath%\documents\default.rdp

 

Filed Under: How To

Reader Interactions

Comments

  1. ?????? ???? says

    March 6, 2020 at 8:10 am

    Oh Thank You For This article , useful

  2. Jennifer says

    March 20, 2020 at 7:04 am

    Would you recommend that individuals (non-IT) do this on their own? Or should an IT Administrator regularly be clearing the cache for all end users?

  3. Chaiya says

    July 26, 2020 at 4:19 pm

    very useful. thank you.

  4. Mehmet CELIK says

    October 10, 2020 at 12:20 pm

    open RDP, than right click over RDP on start bar. All history still there.

  5. Deak says

    December 7, 2020 at 9:44 am

    This is great but bear in mind the problem may just be lack of resources in Windows with users just putting their PC to sleep at night and never actually rebooting the PC. A true reset or shutdown and restart may clear the error message too.

  6. Steve says

    December 18, 2020 at 7:11 pm

    Yeah, I too discovered that this method doesn’t clear the history when you right-click on a RDP icon pinned to the taskbar, which is the way I use it to connect to clients. Is there a way to clear THAT history?

  7. Dons says

    February 4, 2021 at 5:37 am

    You can manually unpin the history when you right click on the rdp icon.

  8. Usama Mansuri says

    April 29, 2021 at 1:55 pm

    Best way to use command line to clear RDP cache.
    Thank you.

Leave a Reply Cancel reply

Primary Sidebar

Link to my LinkedIn Profile
Buy me a coffee

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 245 other subscribers.

Go to mobile version