2025-07-19 16:41:22
, some articles are time-sensitive, if there are errors or the download address is invalid, please in the comment area at the end of the articlemessageIn our daily use of Windows 10/11 system comes with itremoteAfter the desktop is connected, there will always be a history left in the remote desktop connection box, as shown in the figure below. If there are many machines that have been connected, even if they just try to connect, they will be recorded under the remote desktop connection box, and multiple records will affect us to quickly select the machine to actually connect to next time, which is very distressing.
![Picture [1] - Automatically clear the IP history recorded by the Windows system after connecting via mstsc Remote Desktop - eleven sheets](https://www.11zhang.com/wp-content/uploads/2023/03/0ccedcb934bd958e21171e3a1e6308d8.png)
Eleven (www.11zhang.com) also shared a "Clear Windows 10/11 system Remote Desktop connection records".
Today, a friend asked: Can the remote desktop connection record be automatically cleared every time the remote desktop connection is disconnected?
![Picture [2] - Automatically clear the IP history recorded by the Windows system after connecting via mstsc Remote Desktop - eleven sheets](https://www.11zhang.com/wp-content/uploads/2025/07/59b2900aa020250719143007.webp)
In Windows 10/11 systems, after using mstsc (Remote Desktop Connection), the system records the IP address or computer name of the most recently connected. These records are usually stored in the registry and in the Default.rdp configuration file. To automatically clear these records, we can write a script (such as a batch or PowerShell script) to delete these registry keys and configuration files, and then set the script to run every time a user logs out or log in, or through task scheduling to run periodically.
Procedure:
1. Create a batch script ClearRDPHistory.bat file, omitted here, eleven (www.11zhang.com) have already written the batch script.
Effect:
2. Configure the task scheduler to execute automatically, or execute batch scripts through third-party scheduled task tools, one is recommended here zTasker Automated task tools that can be triggered with automated conditions such as scheduled or system events.
For example, I use zTasker Create a new batch script that automatically executes remote record cleaning after 10 seconds of booting, and follow these steps:
(1) After opening the zTasker tool, click [
![Picture [3] - Automatically clear the IP history recorded by the Windows system after connecting via mstsc Remote Desktop - eleven sheets](https://www.11zhang.com/wp-content/uploads/2025/07/5d569bfcb720250719162848.webp)
(2) Select "Task Type":
![Picture [4] - Automatically clear the IP history recorded by the Windows system after connecting via mstsc Remote Desktop - eleven sheets](https://www.11zhang.com/wp-content/uploads/2025/07/317700cdea20250719162848.webp)
(3) The plan is set to choose 10 seconds after the boot, as shown in the figure below;
![Picture [5] - Automatically clear the IP history recorded by the Windows system after connecting via mstsc Remote Desktop - eleven sheets](https://www.11zhang.com/wp-content/uploads/2025/07/d6af36614120250719162849.webp)
(4) The setting is completed, as shown in the figure below;
![Picture [6] - Automatically clear the IP history recorded by the Windows system after connecting via mstsc Remote Desktop - eleven sheets](https://www.11zhang.com/wp-content/uploads/2025/07/66b3c53a7020250719162850.webp)
(5) In the same way, you can also set the batch processing to be executed every hour/minute.
![Picture[7] - Automatically clear the IP history recorded by the Windows system after connecting via mstsc Remote Desktop - eleven sheets](https://www.11zhang.com/wp-content/uploads/2025/07/15a085364d20250719162849.webp)
No comments yet