Windows Defender 防火牆: 允許記錄 的登錄值 LogDroppedPackets 等 3 個 (StandardProfile\Logging)電腦HKLM\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging

原則 ID
WF_Logging_Name_2
適用範圍
電腦設定
支援的作業系統
至少需要 Windows XP Professional SP2
來源
Administrative Templates (.admx) for Windows 11 2026 Update (26H2) (版本 1.0)
類別
網路 › 網路連線 › Windows Defender 防火牆 › 標準設定檔

登錄

LogDroppedPackets

REG_SZ電腦
停用時的值
0
以 .reg · CMD · PowerShell 套用
已停用
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging]
"LogDroppedPackets"="0"
CMD · 已停用
reg add "HKLM\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging" /v "LogDroppedPackets" /t REG_SZ /d 0 /f
PowerShell · 已停用
New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Force | Out-Null
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Name 'LogDroppedPackets' -PropertyType String -Value '0' -Force | Out-Null

LogSuccessfulConnections

REG_SZ電腦
停用時的值
0
以 .reg · CMD · PowerShell 套用
已停用
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging]
"LogSuccessfulConnections"="0"
CMD · 已停用
reg add "HKLM\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging" /v "LogSuccessfulConnections" /t REG_SZ /d 0 /f
PowerShell · 已停用
New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Force | Out-Null
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Name 'LogSuccessfulConnections' -PropertyType String -Value '0' -Force | Out-Null

LogDroppedPackets

REG_DWORD電腦
已核取
1
未核取
0
元素
記錄丟棄的封包
值類型
REG_DWORD
以 .reg · CMD · PowerShell 套用
.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging]

; 選項 (只使用其中一個)
; 已核取
"LogDroppedPackets"=dword:00000001
; 未核取
"LogDroppedPackets"=dword:00000000
CMD
:: 選項 (只使用其中一個)

:: 已核取
reg add "HKLM\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging" /v "LogDroppedPackets" /t REG_DWORD /d 1 /f
:: 未核取
reg add "HKLM\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging" /v "LogDroppedPackets" /t REG_DWORD /d 0 /f
PowerShell
# 共通: 建立機碼
New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Force | Out-Null

# 選項 (只使用其中一個)
# 已核取
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Name 'LogDroppedPackets' -PropertyType DWord -Value 1 -Force | Out-Null
# 未核取
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Name 'LogDroppedPackets' -PropertyType DWord -Value 0 -Force | Out-Null

LogSuccessfulConnections

REG_DWORD電腦
已核取
1
未核取
0
元素
記錄成功的連線
值類型
REG_DWORD
以 .reg · CMD · PowerShell 套用
.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging]

; 選項 (只使用其中一個)
; 已核取
"LogSuccessfulConnections"=dword:00000001
; 未核取
"LogSuccessfulConnections"=dword:00000000
CMD
:: 選項 (只使用其中一個)

:: 已核取
reg add "HKLM\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging" /v "LogSuccessfulConnections" /t REG_DWORD /d 1 /f
:: 未核取
reg add "HKLM\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging" /v "LogSuccessfulConnections" /t REG_DWORD /d 0 /f
PowerShell
# 共通: 建立機碼
New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Force | Out-Null

# 選項 (只使用其中一個)
# 已核取
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Name 'LogSuccessfulConnections' -PropertyType DWord -Value 1 -Force | Out-Null
# 未核取
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Name 'LogSuccessfulConnections' -PropertyType DWord -Value 0 -Force | Out-Null

LogFilePath

REG_SZ電腦
啟用時的值
取決於選項值
元素
記錄檔路徑和名稱:
值類型
REG_SZ
必要
true
以 .reg · CMD · PowerShell 套用
.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging]

; 值名稱與類型依照 ADMX。請自行填入下方的 <輸入值>
"LogFilePath"="<輸入值>"
CMD
:: 值名稱與類型依照 ADMX。請自行填入下方的 <輸入值>

reg add "HKLM\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging" /v "LogFilePath" /t REG_SZ /d "<輸入值>" /f
PowerShell
# 值名稱與類型依照 ADMX。請自行填入下方的 <輸入值>

New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Force | Out-Null
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Name 'LogFilePath' -PropertyType String -Value '<輸入值>' -Force | Out-Null

LogFileSize

REG_DWORD電腦
啟用時的值
取決於選項值
元素
大小限制 (KB):
值類型
REG_DWORD
必要
true
最小值
128
最大值
32767
以 .reg · CMD · PowerShell 套用
.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging]

; 值名稱與類型依照 ADMX。請自行填入下方的 <輸入值>
"LogFileSize"=dword:<輸入值>
CMD
:: 值名稱與類型依照 ADMX。請自行填入下方的 <輸入值>

reg add "HKLM\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging" /v "LogFileSize" /t REG_DWORD /d "<輸入值>" /f
PowerShell
# 值名稱與類型依照 ADMX。請自行填入下方的 <輸入值>

New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Force | Out-Null
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\Logging' -Name 'LogFileSize' -PropertyType DWord -Value '<輸入值>' -Force | Out-Null