自今天 2021-07-21 起,我通过 powershell 激活的临时规则似乎不再起作用,我收到以下错误:
PS C:\WINDOWS\system32> New-NetFirewallRule -DisplayName "Block Outbound Port 80" -Direction Outbound -LocalPort 80 -Protocol TCP -Action Block
New-NetFirewallRule : The requested object could not be found.
At line:1 char:1
+ New-NetFirewallRule -DisplayName "Block Outbound Port 80" -Direction ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (MSFT_NetFirewallRule:root/standardcimv2/MSFT_NetFirewallRule) [New-NetFirewallRule], CimException
+ FullyQualifiedErrorId : MI RESULT 6,New-NetFirewallRule
看起来像最后一部分触发错误:-Action Block
根据评论中的要求,这是输出:
PS C:\WINDOWS\system32> Get-NetFirewallRule -DisplayName "Block Outbound Port 80"
Get-NetFirewallRule : No MSFT_NetFirewallRule objects found with property 'DisplayName' equal to 'Block Outbound Port 80'. Verify the value of the property and retry.
At line:1 char:1
+ Get-NetFirewallRule -DisplayName "Block Outbound Port 80"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Block Outbound Port 80:String) [Get-NetFirewallRule], CimJobException
+ FullyQualifiedErrorId : CmdletizationQuery_NotFound_DisplayName,Get-NetFirewallRule