Windows

How to Change Windows 11 Security Event Retention

Richard
Written by
Richard
Jul 2, 2022 Updated Apr 15, 2026 2 min read

This guide explains how to change how long Windows Security Protection history keeps a record of your past security events on Windows 11.

The Protection history page in the Windows Security app tracks actions taken by Microsoft Defender Antivirus. This includes things like removing unwanted apps or blocking risky services.

Why change this? By default, Protection history only keeps these records for 15 days. If you want to look back further, you need to change this setting.

What happens when done? Your computer will keep these security logs for the exact number of days you choose. If you set it to zero, the records will never be deleted automatically.

Change Protection History Retention

You can adjust how long these events stay on your computer using PowerShell.

Note: You must have administrator privileges to perform these steps.

  1. Open the Start menu and search for PowerShell.
  2. Right-click it and select Run as administrator.
  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

The default value is 15.

To change the number of days, use this command format:

PowerShell
Set-MpPreference -ScanPurgeItemsAfterDelay <days>

Replace <days> with your preferred number. For example, to keep records for 100 days, type:

PowerShell
Set-MpPreference -ScanPurgeItemsAfterDelay 100
Changing Windows Security Protection history event logs

Summary

Windows 11 automatically clears your Microsoft Defender security logs every 15 days. By using the PowerShell command Set-MpPreference -ScanPurgeItemsAfterDelay, you can customize this duration or stop the logs from being deleted entirely by setting the value to 0. This gives you more control over your security audit trails using PowerShell.

How can I change the retention period for Windows Security Protection history events?

You can change the retention period by using PowerShell. Open PowerShell as an administrator and run the command 'Set-MpPreference -ScanPurgeItemsAfterDelay ', replacing with the number of days you want to retain the events.

What is the default retention period for Protection history events in Windows 11?

By default, Protection history events in Windows 11 are retained for 15 days. After this period, the events will automatically disappear from the Protection history page.

Can I set the Protection history events to never be removed?

Yes, you can set the retention period to zero (0) days, which means that Protection history events will not be automatically removed and will be retained indefinitely.

What command do I use to check the current purge settings for Protection history?

To check the current purge settings, open PowerShell as an administrator and run the command 'Get-MpPreference | Select-Object -Property ScanPurgeItemsAfterDelay'. This will show you the current setting for how long events are retained.

What actions can I view in the Windows Security Protection history?

In the Windows Security Protection history, you can view actions taken by Microsoft Defender Antivirus, such as the removal of Potentially Unwanted Apps and the disabling of critical services. This helps you track the security measures taken on your device.

Was this guide helpful?

Tags: #Windows 11
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, the owner and lead writer at Geek Rewind, is a tech enthusiast passionate about simplifying complex IT topics. His years of hands-on experience in system administration and enterprise IT operations have honed his ability to provide practical insights and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

Leave a Reply

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

Exit mobile version