Turn on removal of items from scan history folder
Activer la suppression des éléments du dossier de l’historique de l’analyse
Explanation
This policy setting defines the number of days items should be kept in the scan history folder before being permanently removed. The value represents the number of days to keep items in the folder. If set to zero, items will be kept forever and will not be automatically removed. By default, the value is set to 30 days.
If you enable this setting, items will be removed from the scan history folder after the number of days specified.
If you disable or do not configure this setting, items will be kept in the scan history folder for the default number of days.
Ce paramètre de stratégie définit le nombre de jours pendant lesquels les éléments doivent être conservés dans le dossier de l’historique de l’analyse avant d’être supprimés définitivement. La valeur représente le nombre de jours pendant lesquels les éléments doivent être conservés dans le dossier. Si la valeur est zéro, les éléments sont conservés pour toujours et ne sont pas automatiquement supprimés. Par défaut, la valeur est égale à 30 jours.
Si vous activez ce paramètre, les éléments sont supprimés du dossier de l’historique de l’analyse après le nombre de jours spécifié.
Si vous désactivez ou ne configurez pas ce paramètre, les éléments sont conservés dans le dossier de l’historique de l’analyse pendant le nombre de jours par défaut.
Registry
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows Defender\Scan- Value name
PurgeItemsAfterDelay
| State | Value written |
|---|---|
| Enabled | not defined in the ADMX (see the options below) |
| Disabled | not defined in the ADMX (see the options below) |
PowerShell
PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.
The ADMX does not specify the value written when enabled; the GPO editor usually writes REG_DWORD 1 (enabled) / 0 (disabled). The commands below use 1/0 as an assumption.
Writing directly to the registry bypasses Group Policy: if a GPO manages this value, it will be rewritten at the next gpupdate; otherwise the value stays in place (the "tattooing" effect). Prefer a GPO or, locally, LGPO.exe. Run PowerShell as administrator for HKLM. Some policies need a restart or gpupdate /force.
Enable
# Enable: WindowsDefender/Scan_PurgeItemsAfterDelay
$k = 'HKLM:\Software\Policies\Microsoft\Windows Defender\Scan'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
# The ADMX does not specify the value written; the GPO editor usually writes REG_DWORD 1 (enabled) / 0 (disabled)
Set-ItemProperty -Path $k -Name 'PurgeItemsAfterDelay' -Value 1 -Type DWord # assumed value (not defined in the ADMX)
# Turn on removal of items from scan history folder
Set-ItemProperty -Path $k -Name 'PurgeItemsAfterDelay' -Value 30 -Type DWord # between 0 and 4294967295Disable
# Disable: WindowsDefender/Scan_PurgeItemsAfterDelay
$k = 'HKLM:\Software\Policies\Microsoft\Windows Defender\Scan'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
# The ADMX does not specify the value written; the GPO editor usually writes REG_DWORD 1 (enabled) / 0 (disabled)
Set-ItemProperty -Path $k -Name 'PurgeItemsAfterDelay' -Value 0 -Type DWord # assumed value (not defined in the ADMX)Revert to "Not configured"
# Revert to "Not configured": WindowsDefender/Scan_PurgeItemsAfterDelay
$k = 'HKLM:\Software\Policies\Microsoft\Windows Defender\Scan'
Remove-ItemProperty -Path $k -Name 'PurgeItemsAfterDelay' -ErrorAction SilentlyContinueOptions (1)
| Label | Control | Registry value | REG type | Constraints / details |
|---|---|---|---|---|
| Turn on removal of items from scan history folderActiver la suppression des éléments du dossier de l’historique de l’analyseScan_PurgeItemsAfterDelay | Numeric boxdecimal | PurgeItemsAfterDelay | REG_DWORD | Min: 0 · Max: 4294967295 · Default (UI): 30 |