我一直在网上闲逛,但我似乎无法找到这个问题的明确答案。我被迫使用 PowerShell v2。我知道使用以下命令将为我提供所有防火墙规则的列表:
netsh advfirewall firewall show rule name=all
但是它让我得到这样的输出:
Rule Name: Core Networking - Teredo (ICMPv6-In)
---------- ------------------------------------
Enabled: Yes
Direction: In
Profiles: Domain,Private,Public
Grouping: Core Networking
LocalIP: Any
RemoteIP: Any
Protocol: ICMPv6
Type Code
128 Any
Edge traversal: No
Action: Allow
Run Code Online (Sandbox Code Playgroud)
我需要找到的是创建/启用规则的确切时间。这可能吗?或者,有没有办法设置临时(定时)Windows 防火墙规则?
*编辑:似乎确实没有办法使用 netsh 或特定于防火墙的 powerhshell v2 cmdlet 来执行此操作,但是我相信我的解决方案可能位于 /Applications and Services Logs/Microsoft/Windows/Windows Firewall With Advanced Security/事件 ID 为 2004/2006 下的防火墙日志。
****编辑:** 可以使用以下命令查看Instance ID 2004(防火墙已添加规则...):
Get-WinEvent -LogName "Microsoft-Windows-Windows Firewall With Advanced Security/Firewall" | Where-Object {$_.ID -eq …