Windows Defender Firewall: Allow logging
Pare-feu Windows Defender : autoriser la journalisation
Explanation
Allows Windows Defender Firewall to record information about the unsolicited incoming messages that it receives.
If you enable this policy setting, Windows Defender Firewall writes the information to a log file. You must provide the name, location, and maximum size of the log file. The location can contain environment variables. You must also specify whether to record information about incoming messages that the firewall blocks (drops) and information about successful incoming and outgoing connections. Windows Defender Firewall does not provide an option to log successful incoming messages.
If you are configuring the log file name, ensure that the Windows Defender Firewall service account has write permissions to the folder containing the log file. Default path for the log file is %systemroot%\system32\LogFiles\Firewall\pfirewall.log.
If you disable this policy setting, Windows Defender Firewall does not record information in the log file. If you enable this policy setting, and Windows Defender Firewall creates the log file and adds information, then upon disabling this policy setting, Windows Defender Firewall leaves the log file intact.
If you do not configure this policy setting, Windows Defender Firewall behaves as if the policy setting were disabled.
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é.
Registry
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging- Value name
- not defined in the ADMX
| State | Value written | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Enabled | not defined in the ADMX (see the options below) | |||||||||
| Disabled |
|
PowerShell
PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.
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: WindowsFirewall/WF_Logging_Name_2
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
# Log dropped packets
# unchecked: 0
Set-ItemProperty -Path $k -Name 'LogDroppedPackets' -Value 1 -Type DWord
# Log successful connections
# unchecked: 0
Set-ItemProperty -Path $k -Name 'LogSuccessfulConnections' -Value 1 -Type DWord
# Log file path and name
Set-ItemProperty -Path $k -Name 'LogFilePath' -Value '<value>' -Type String
# Size limit (KB)
Set-ItemProperty -Path $k -Name 'LogFileSize' -Value 4096 -Type DWord # between 128 and 32767Disable
# Disable: WindowsFirewall/WF_Logging_Name_2
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'LogDroppedPackets' -Value '0' -Type String
Set-ItemProperty -Path $k -Name 'LogSuccessfulConnections' -Value '0' -Type StringRevert to "Not configured"
# Revert to "Not configured": WindowsFirewall/WF_Logging_Name_2
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging'
Remove-ItemProperty -Path $k -Name 'LogDroppedPackets' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'LogSuccessfulConnections' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'LogFilePath' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'LogFileSize' -ErrorAction SilentlyContinueOptions (4)
| Label | Control | Registry value | REG type | Constraints / details |
|---|---|---|---|---|
| Log dropped packetsEnregistrer les paquets ignorés dans le journalWF_Logging_LogDroppedPackets | Check boxboolean | LogDroppedPackets | REG_DWORD | Checked: REG_DWORD = 1Unchecked: REG_DWORD = 0 |
| Log successful connectionsEnregistrer les connexions réussies dans le journalWF_Logging_LogSuccessfulConnections | Check boxboolean | LogSuccessfulConnections | REG_DWORD | Checked: REG_DWORD = 1Unchecked: REG_DWORD = 0 |
| Log file path and name:Chemin d’accès et nom de fichier du journal :WF_Logging_LogFilePathAndName | Text boxtext | LogFilePath | REG_SZ | Required · Default (UI): %systemroot%\system32\LogFiles\Firewall\pfirewall.log |
| Size limit (KB):Limite de taille (Ko) :WF_Logging_SizeLimit | Numeric boxdecimal | LogFileSize | REG_DWORD | Required · Min: 128 · Max: 32767 · Default (UI): 4096 |