Remote Desktop Protocol (RDP) allows users to connect remotely to other computers over a network. When connecting to various remote hosts, Windows stores information about these connections in the registry for future use. Over time, this cache can accumulate entries for connections that are no longer needed or relevant. Manually removing these cached RDP connections from the Windows Registry can be tedious and time-consuming, especially in environments with multiple connections. Fortunately, PowerShell provides a convenient way to automate this process.

Using the PowerShell Script

Step 1: Download the Script You can download the PowerShell script from the GitHub repository at https://github.com/mirrayhan08/PowerShell-RDPCacheCleaner.

Step 2: Prepare Environment Before running the script, ensure that you have the necessary permissions to modify the registry. Additionally, make sure that PowerShell execution policy allows running scripts. You can set the execution policy using the following command:

Set-ExecutionPolicy RemoteSigned

Step 3: Run the Script Open PowerShell with administrator privileges and navigate to the directory where you downloaded the script. Run the script by executing the following command:

.\Remove_RDP_Cachs.ps1

Step 4: Review and Confirm The script will prompt you for confirmation before deleting each cached RDP connection. Review the list of connections and confirm deletion as prompted.

Step 5: Verify Changes After the script has finished running, open Registry Editor (regedit) to verify that the cached RDP connections have been removed.

Manual Removal Process

If you prefer not to use the PowerShell script, you can manually remove cached RDP connections from the Windows Registry. Here’s how:

Open Registry Editor:

  • Press Win + R on your keyboard to open the “Run” dialog.
  • Type regedit and press Enter. This action opens the Registry Editor.

Navigate to the RDP Cache Key:

  • In the Registry Editor, navigate to the following path: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Terminal Server Client\Servers
  • This path contains the cached RDP connections.

Identify RDP Entries:

  • Under the “Servers” key, you will see various subkeys, each representing a cached RDP connection.
  • Each subkey represents a saved RDP connection configuration.

Delete Unwanted Entries:

  • Review the list of subkeys under “Servers” to identify the RDP connections you want to remove.
  • Right-click on the subkey representing the RDP connection you want to delete.
  • Select “Delete” from the context menu.
  • Confirm the deletion if prompted.

Repeat as Necessary:

  • Repeat the above steps for each RDP connection you wish to remove.
  • Ensure you do not delete the “Default” entry, as it is a system default and should not be removed.

Close Registry Editor:

  • Once you have deleted all desired RDP connections, close the Registry Editor.

Verify Changes:

  • You can verify that the RDP connections have been removed by reopening the Registry Editor and checking the “Servers” key under HKEY_CURRENT_USER\SOFTWARE\Microsoft\Terminal Server Client.

Restart if Needed:

  • In some cases, changes to the registry may require a system restart to take effect. If necessary, restart your computer to apply the changes.

By Rayhan

My name is Rayhan and I'm an IT professional with over 10 years of experience in the field. I'm passionate about all things tech, and I love helping people solve their IT problems. In my free time, I enjoy tinkering with new gadgets and software, and I'm always on the lookout for the latest tech trends. I believe that technology has the power to make our lives easier and more enjoyable, and I'm excited to be a part of this ever-evolving field. Thank you for taking the time to visit my page.

Leave a Reply

Your email address will not be published. Required fields are marked *