How to prevent Microsoft Defender from quarantining safe files

Last update: 26th October 2026
  • Procedures for restoring isolated files using the Windows Security interface, the MpCmdRun console, or the endpoint portal.
  • Security criteria to differentiate a false positive from a real threat before recovering any executable.
  • Configure path and folder exclusions to prevent the antivirus from repeatedly deleting legitimate files.
  • System repair methods and deep cleaning using safe mode and console commands to fix detection errors.

Laptop with a padlock icon and the word "Secured" on screen, representing file security.

Sometimes, Windows security goes overboard and ends up quarantining completely harmless files , leaving us vulnerable just when we need to run an important program. This is what we call a false positive, and it happens basically because the antivirus detects a pattern it deems suspicious, even though the file is actually legitimate and safe.

If you've ever had Microsoft Defender delete an executable file or a document you need for work, don't despair. There are several ways to recover that data and, more importantly, to configure your system to prevent it from happening again. In this article, we'll cover everything from the simplest steps to more advanced tricks for taming your antivirus.

How to recover files that have ended up in quarantine

Close-up of a laptop with the text "CYBER SECURITY" in red, symbolizing antivirus and cybersecurity alerts.

When antivirus software isolates a file, it doesn't immediately delete it completely, but rather moves it to a safe area where it can't cause harm. To recover it, the quickest way is to open the Windows Security app , navigate to the Virus & threat protection section, and review the Protection history. There you can filter by quarantined items, select the file you want, and click the Restore option to return it to its original location.

  Multimedia in smart buildings: IoT, comfort, security and efficiency

If you're someone who prefers not to click through menus and you're more comfortable using the console, you can use the utility MpCmdRun.exeTo do this, you must open Command Prompt as administrator. First, it's recommended to navigate to the Defender platform directory and run the command. -Restore -ListAll To view the list of trapped files. Once you've located the exact name, simply run the command -Restore -Name <nombre_del_archivo> all with return the file to its location.

For more professional or enterprise environments, the Microsoft Defender Endpoint Portal allows you to manage these situations remotely. From there, you can collect the file in a password-protected .zip package, allowing you to analyze it before deciding whether it's safe to return it to the employee's computer.

Critical analysis: Is it really a false positive?

A person's hands operating a laptop with a digital data analysis interface, representing the verification of false positives.

Before recovering anything, it's important to be realistic. It's not advisable to restore a file blindly just because you need it. Ideally, you should verify the file's origin : Who sent it? What website was it downloaded from? And was it digitally signed? If the file is an installer for well-known software, the wisest course of action is to compare it with the official version from the manufacturer or check the file's hash value to ensure it hasn't been tampered with.

If you work for a small or medium-sized business (SMB), it's crucial not to test on the production PC. It's best to obtain a clean copy from the vendor's official repository rather than relying on a file that has already been blocked. If the file contains sensitive data, avoid uploading it to public online analyzers to prevent exposing confidential company information.

  The Best Free Antivirus for Windows

Prevent Defender from continuing to delete your files

Computer security expert analyzing code on monitors, representing advanced exclusion settings in antivirus software.

If you already know the file is safe but Defender keeps deleting it every time you restart, the definitive solution is to create a folder or file exclusion . To do this, go to Virus & threat protection settings and look for the Add or Remove Exclusions option. By adding the entire folder where the program resides, you're telling the antivirus to ignore that specific path during its scans.

An advanced trick for those who use third-party antivirus (such as Avast or Malwarebytes) and notice that Defender is still running in the background is to activate the Periodic analysisThis makes the exclusions interface visible and allows you to save the paths in the Windows Registry (specifically in the key). HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Defender\\Exclusions\\Paths), ensuring that exclusion persists even if Defender is technically disabled.

Troubleshooting and deep cleaning

Data center terminal displaying a blue screen error, illustrating troubleshooting and critical system errors.

In cases where the antivirus returns errors when attempting to remove a threat, or the protection history is not cleared, there may be corrupted files on the system. Run the command DISM.exe /Online /Cleanup-image /Restorehealth in the administrator console helps repair the Windows imageIf the problem persists, the command Sfc /scannow It is the ideal tool for correcting errors in protected operating system files.

If you suspect you have an infection that's blocking Defender from working, the most effective solution is to restart your PC in Safe Mode and run Microsoft Defender Offline Scan. This tool can remove persistent malware that hides while the operating system is fully loaded. For extra cleaning, third-party tools like Malwarebytes or AdwCleaner are excellent complements to ensure no trace of malicious scripts remains.

  How to Split Screen in Two in Windows 2 Easily

For those who want to manually clear the alert history and start from scratch, it is possible to delete the contents of the service folder in C:\\ProgramData\\Microsoft\\Windows Defender\\Scan\\History\\ServiceHowever, this requires temporarily disabling real-time protection and cloud protection. You can also adjust the automatic purge time for quarantined items using PowerShell with the command Set-MpPreference-ScanPurgeItemsAfterDelay followed by the desired number of days.

Maintaining a balance between security and usability involves managing antivirus alerts without disabling overall protection. The most sensible approach is to document each exclusion created, verify files using official sources, and use deep scan tools when native Windows tools are overwhelmed by a real threat or system error.