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.
You can clear the RDP Cache history in a couple of ways:
Clear the RDP Cache from the registry using regedit
- Open regedit.exe and navigate to:
HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client
- 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.
- 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:
- Select the entries that you want to remove, right click and click delete:
- 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:
- There may be many entries, it is easier to delete the entire servers key, then recreate it.
- 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:
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
?????? ???? says
Oh Thank You For This article , useful
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?
very useful. thank you.
Mehmet CELIK says
open RDP, than right click over RDP on start bar. All history still there.
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.
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?
You can manually unpin the history when you right click on the rdp icon.
Usama Mansuri says
Best way to use command line to clear RDP cache.
This batch file does not work on Windows 11. Is there a way to make it work on Windows 11? Please help me out. Please