Pare-feu Windows Defender : autoriser la journalisation
Vérifié avec Windows 11 25H2 — mis à jour le 12 juillet 2026
Pris en charge sur : Au minimum Windows XP Professionnel avec SP2
Chemin dans la console GPO
Configuration ordinateur\Modèles d'administration\Réseau\Connexions réseau\Pare-feu Windows Defender\Profil standard Description
Autorise le Pare-feu Windows Defender à enregistrer des informations sur les messages entrants non sollicités qu'il reçoit. Si vous activez ce paramètre de stratégie, le Pare-feu Windows Defender écrira les informations dans un fichier journal. Vous devez spécifier le nom, l'emplacement et la taille maximale du fichier journal. L'emplacement peut contenir des variables d'environnement. Vous devez également spécifier si vous souhaitez enregistrer les informations sur les messages entrants que le pare-feu bloque (perd), et les informations sur les connexions entrantes et sortantes établies. Le Pare-feu Windows Defender n'offre aucune option permettant d'enregistrer les messages entrants reçus. Si vous configurez le nom du fichier journal, assurez-vous que le compte du service de Pare-feu Windows Defender possède les autorisations d'écriture dans le dossier contenant le fichier journal. Le chemin d'accès par défaut du fichier journal est le suivant : %systemroot%\system32\LogFiles\Firewall\pfirewall.log. Si vous désactivez ce paramètre de stratégie, le Pare-feu Windows Defender n'enregistre pas les informations dans le fichier journal. Si vous activez ce paramètre de stratégie, et que le Pare-feu Windows Defender crée le fichier journal et y ajoute des informations, le fichier journal n'est pas modifié. Si vous ne configurez pas ce paramètre de stratégie, le Pare-feu Windows Defender se comportera comme si le paramètre de stratégie était désactivé.
Registre
SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging Cette stratégie définit plusieurs valeurs de registre :
LogDroppedPackets LogDroppedPackets = (non défini) LogDroppedPackets = 0 LogSuccessfulConnections LogSuccessfulConnections = (non défini) LogSuccessfulConnections = 0 Générateur d'exports
BETAConfigurez l'état, la portée et les options, puis générez les sorties .reg, PowerShell, Intune et SCCM — ou ajoutez le paramètre à une collection multi-paramètres.
Ces exports écrivent le registre — ce n'est pas une GPO managée. ⓘ
Fichier .reg
Windows Registry Editor Version 5.00
; Exported from gporais.com
; Policy: Pare-feu Windows Defender : autoriser la journalisation
; State: Enabled
; Supported on: Au minimum Windows XP Professionnel avec SP2
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging]
; "LogDroppedPackets" = (not defined)
; "LogSuccessfulConnections" = (not defined)
"LogDroppedPackets"=dword:00000000
"LogSuccessfulConnections"=dword:00000000
"LogFilePath"=""
"LogFileSize"=dword:00001000 Autres formats (PowerShell, Intune, SCCM)
PowerShell
# Exported from gporais.com
# Policy: Pare-feu Windows Defender : autoriser la journalisation
# State: Enabled
# Supported on: Au minimum Windows XP Professionnel avec SP2
$path = 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging'
New-Item -Path $path -Force | Out-Null
# LogDroppedPackets = (not defined)
# LogSuccessfulConnections = (not defined)
Set-ItemProperty -Path $path -Name 'LogDroppedPackets' -Value 0 -Type DWord
Set-ItemProperty -Path $path -Name 'LogSuccessfulConnections' -Value 0 -Type DWord
Set-ItemProperty -Path $path -Name 'LogFilePath' -Value '' -Type String
Set-ItemProperty -Path $path -Name 'LogFileSize' -Value 4096 -Type DWord Intune XML
Aucune correspondance directe Policy CSP / OMA-URI pour cette stratégie. Utilisez l'onglet Intune Remediation, ou importez l'ADMX dans Intune. Intune Remediation
# === Detection script ===
# Exported from gporais.com
# Policy: Pare-feu Windows Defender : autoriser la journalisation
# State: Enabled
# Supported on: Au minimum Windows XP Professionnel avec SP2
function Test-RegistryValue {
param(
[Parameter(Mandatory = $true)][string]$Path,
[Parameter(Mandatory = $true)][string]$Name,
[object]$Expected,
[ValidateSet('String', 'DWord', 'MultiString')][string]$Kind = 'String',
[switch]$Absent
)
try {
$item = Get-ItemProperty -LiteralPath $Path -Name $Name -ErrorAction Stop
} catch {
return $Absent.IsPresent
}
if ($Absent.IsPresent) { return $false }
$actual = $item.$Name
if ($Kind -eq 'DWord') { return ([int64]$actual) -eq ([int64]$Expected) }
if ($Kind -eq 'MultiString') {
$actualValues = @($actual)
$expectedValues = @($Expected)
if ($actualValues.Count -ne $expectedValues.Count) { return $false }
for ($i = 0; $i -lt $expectedValues.Count; $i++) {
if ([string]$actualValues[$i] -ne [string]$expectedValues[$i]) { return $false }
}
return $true
}
return [string]$actual -eq [string]$Expected
}
# HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging\LogDroppedPackets: LogDroppedPackets= is not representable as a registry value.
# HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging\LogSuccessfulConnections: LogSuccessfulConnections= is not representable as a registry value.
$checks = @(
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Name 'LogDroppedPackets' -Expected 0 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Name 'LogSuccessfulConnections' -Expected 0 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Name 'LogFilePath' -Expected '' -Kind String)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Name 'LogFileSize' -Expected 4096 -Kind DWord)
)
if ($checks -notcontains $false) {
Write-Output 'Compliant'
exit 0
}
Write-Output 'Non-compliant'
exit 1
# === Remediation script ===
# Exported from gporais.com
# Policy: Pare-feu Windows Defender : autoriser la journalisation
# State: Enabled
# Supported on: Au minimum Windows XP Professionnel avec SP2
$path = 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging'
New-Item -Path $path -Force | Out-Null
# LogDroppedPackets = (not defined)
# LogSuccessfulConnections = (not defined)
Set-ItemProperty -Path $path -Name 'LogDroppedPackets' -Value 0 -Type DWord
Set-ItemProperty -Path $path -Name 'LogSuccessfulConnections' -Value 0 -Type DWord
Set-ItemProperty -Path $path -Name 'LogFilePath' -Value '' -Type String
Set-ItemProperty -Path $path -Name 'LogFileSize' -Value 4096 -Type DWord Scripts SCCM
# Exported from gporais.com
# Policy: Pare-feu Windows Defender : autoriser la journalisation
# State: Enabled
# Supported on: Au minimum Windows XP Professionnel avec SP2
# SCCM Configuration Item guidance:
# Create a Configuration Item of type "Setting: Script".
# Discovery script: use the Detection script below.
# Remediation script: use the Remediation script below.
# Compliance rule: the Discovery script output equals 'Compliant'.
# === Detection script ===
# Exported from gporais.com
# Policy: Pare-feu Windows Defender : autoriser la journalisation
# State: Enabled
# Supported on: Au minimum Windows XP Professionnel avec SP2
function Test-RegistryValue {
param(
[Parameter(Mandatory = $true)][string]$Path,
[Parameter(Mandatory = $true)][string]$Name,
[object]$Expected,
[ValidateSet('String', 'DWord', 'MultiString')][string]$Kind = 'String',
[switch]$Absent
)
try {
$item = Get-ItemProperty -LiteralPath $Path -Name $Name -ErrorAction Stop
} catch {
return $Absent.IsPresent
}
if ($Absent.IsPresent) { return $false }
$actual = $item.$Name
if ($Kind -eq 'DWord') { return ([int64]$actual) -eq ([int64]$Expected) }
if ($Kind -eq 'MultiString') {
$actualValues = @($actual)
$expectedValues = @($Expected)
if ($actualValues.Count -ne $expectedValues.Count) { return $false }
for ($i = 0; $i -lt $expectedValues.Count; $i++) {
if ([string]$actualValues[$i] -ne [string]$expectedValues[$i]) { return $false }
}
return $true
}
return [string]$actual -eq [string]$Expected
}
# HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging\LogDroppedPackets: LogDroppedPackets= is not representable as a registry value.
# HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging\LogSuccessfulConnections: LogSuccessfulConnections= is not representable as a registry value.
$checks = @(
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Name 'LogDroppedPackets' -Expected 0 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Name 'LogSuccessfulConnections' -Expected 0 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Name 'LogFilePath' -Expected '' -Kind String)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Name 'LogFileSize' -Expected 4096 -Kind DWord)
)
if ($checks -notcontains $false) {
Write-Output 'Compliant'
exit 0
}
Write-Output 'Non-compliant'
exit 1
# === Remediation script ===
# Exported from gporais.com
# Policy: Pare-feu Windows Defender : autoriser la journalisation
# State: Enabled
# Supported on: Au minimum Windows XP Professionnel avec SP2
$path = 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging'
New-Item -Path $path -Force | Out-Null
# LogDroppedPackets = (not defined)
# LogSuccessfulConnections = (not defined)
Set-ItemProperty -Path $path -Name 'LogDroppedPackets' -Value 0 -Type DWord
Set-ItemProperty -Path $path -Name 'LogSuccessfulConnections' -Value 0 -Type DWord
Set-ItemProperty -Path $path -Name 'LogFilePath' -Value '' -Type String
Set-ItemProperty -Path $path -Name 'LogFileSize' -Value 4096 -Type DWord Vous construisez une collection multi-paramètres ? Ajoutez ce paramètre et générez des exports combinés (.reg, PowerShell, GPO).