Skip to content
Follow
Windows

How to Change Windows 11 Security Event Retention

Richard
Written by
Richard
Updated 4 min read
How to Send and Receive Text Messages on Windows 11
How to Send and Receive Text Messages on Windows 11

Keep your Windows 11 security logs longer than the default 15-day limit by changing the retention period for Windows Security Protection history. This guide shows how to check the current value, change it, and clear the history by hand if you need to.

Advertisement
⚡ Quick Answer

Open PowerShell as administrator and run Get-MpPreference | Select-Object -Property ScanPurgeItemsAfterDelay to check the current retention period for Protection history. Change it with Set-MpPreference -ScanPurgeItemsAfterDelay followed by the number of days you want, such as 100 for 100 days. The change takes effect immediately.

Advertisement

Understanding 🪟 Windows 11 Protection History

Windows Protection history shows what Microsoft Defender Antivirus has done to keep your computer safe, such as blocking unwanted apps or quarantining suspicious files. You can open it from the Windows Security app. Items older than the retention period are removed, so a longer period means you can look further back.

Why check your Protection History?

The Security Event log shows whether your antivirus detected recent threats. This event log helps you understand if a downloaded program was blocked or if a dangerous-looking file was moved to quarantine. If something odd happened a few weeks ago, this is where you look. With the default retention, that entry may already be gone.

What happens when you review it?

The Windows Defender quarantine list helps you identify false positives. False positives happen when Windows Defender flags a safe file as malicious by mistake. Reviewing this list lets you restore safe files that were caught in the crossfire. Check it before the retention period runs out, because quarantined items are cleared after that time.

Quarantined vs. Blocked vs. Remediated

StatusMeaning
QuarantinedThe file is moved to a safe folder so it cannot run.
BlockedThe app or action was stopped before it could start.
RemediatedThe threat was cleaned or deleted by the antivirus.

How to Change 🪟 Windows 11 Security Event Retention

Windows 11 security event logs track your computer's security activity. By default, Windows 11 keeps these security event logs for 15 days. PowerShell commands let you change the retention period for these security event logs. Modifying this timeframe lets you decide how much security history you want to save for later review.

Advertisement
📝NoteAdministrator privileges are required for this task.

The steps are the same on Windows 11 Home and Pro, because they use PowerShell and not Group Policy.

  1. Open the Start menu and search for PowerShell.
  2. Right-click it and select Run as administrator. If a User Account Control prompt appears, click Yes. A PowerShell window opens with “Administrator” in the title bar.
  3. To see your current setting, type the following command and press Enter:
⬛PowerShell
Get-MpPreference | Select-Object -Property ScanPurgeItemsAfterDelay
Windows 11 Protection history overview screen
show protection history in windows 11

The default value is 15, which is the number of days Windows keeps the history. If you see a different number, someone has already changed it on this PC, or a policy has set it. The following command format changes the number of days:

⬛PowerShell
Set-MpPreference -ScanPurgeItemsAfterDelay <days>

Replace <days> with your preferred number. For example, typing this command keeps records for 100 days:

⬛PowerShell
Set-MpPreference -ScanPurgeItemsAfterDelay 100
⚠️WarningThe change applies right away, and you do not need to restart.

To confirm it, run the first command again and check that the new number is shown. To undo the change, run the same command format with 15 as the number. Keep in mind that a longer period means more history stored on disk, though the amount is small on most PCs.

Changing Windows Security Protection history event logs
change windows security protection history event logs

How to Manually Clear Protection History

Manually clearing your Windows 11 protection history requires deleting files in a specific folder. This process removes the recorded history without getting rid of any actual threats that Windows Defender found. Do this only if you want a clean history, because deleted entries cannot be brought back.

Advertisement

Clearing the history manually requires deleting the contents of the detection folder. Administrator privileges are required for this step.

  1. Open File Explorer and navigate to: C:\ProgramData\Microsoft\Windows Defender\Scans\History\Service\DetectionHistory
  2. You may need to enable 'Hidden items' in the View menu to see the ProgramData folder. In Windows 11, click View Show Hidden items. The folder should now appear in the list.
  3. Delete all files inside the DetectionHistory folder. Delete the files only, not the folder itself. If Windows asks for administrator permission, click Continue.

Open Windows Security and check Protection history afterwards. The old entries should be gone. If a file will not delete, close the Windows Security app and try again.

Summary

Windows 11 Protection history helps you monitor security events. The Set-MpPreference command in PowerShell changes how long these logs remain on the system. Visit the official Microsoft Support website for more information on managing security.

Have a question about this guide?

Answered by AI from this guide. Good questions may be added to this page — please don't include personal details.

Tags: #Windows 11

Did this guide fix your problem?

Richard

About the Author

Richard

Tech Writer, IT Professional

Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.

Advertisement

No comments yet — be the first to share your thoughts!

Leave a Comment

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