为什么Get-NetFirewallRule 不显示防火墙规则的所有信息? [英] Why doesn't Get-NetFirewallRule show all information of the firewall rule?
问题描述
我正在尝试查找防火墙规则是否已经存在,具有相同的名称、相同的配置,例如:localport.
I'm trying to find if a firewall rule already existing, with the same name, same configuration, like: localport.
所以我使用Get-NetFirewallRule
来列出所有规则,但是返回的规则不包含端口信息,也缺少一些其他信息.我在哪里可以找到规则的所有配置.以下是返回的属性:
So I use Get-NetFirewallRule
to list all rules, but the rules returned do not contain the information of port, also some other information are missing. where can I find all the config of a rule. Below is the attributess returned:
Name
DisplayName
Description
DisplayGroup
Group
Enabled
Profile
Platform
Direction
Action
EdgeTraversalPolicy
LooseSourceMapping
LocalOnlyMapping
Owner
PrimaryStatus
Status
EnforcementStatus
PolicyStoreSource
PolicyStoreSourceType
推荐答案
为了查找防火墙规则中已有的端口号,您可以使用不同的 cmdlet Get-NetFirewallPortFilter
.
In order to find the port numbers that are already in the firewall rules, you can use a different cmdlet Get-NetFirewallPortFilter
.
(信息)
使用 Get-NetFirewallRule
过滤您要查看的规则子集并将其通过管道传输到上述 cmdlet.例如:
Use Get-NetFirewallRule
to filter which subset of rules you want to look at and pipe it to the above cmdlet. eg.:
Get-NetFirewallRule -DisplayName "SQL Broker Service" | Get-NetFirewallPortFilter
听起来您所追求的属性是 localport.
Sounds like the property you are after is localport.
这篇关于为什么Get-NetFirewallRule 不显示防火墙规则的所有信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!