Gets the local computer's firewall rules.
Get-FirewallRule [<CommonParameters>]
Get-FirewallRule -Name <String> [<CommonParameters>]
Get-FirewallRule -LiteralName <String> [<CommonParameters>]
Returns a Carbon.Firewall.Rule
object for each firewall rule on the local computer.
This data is parsed from the output of:
netsh advfirewall firewall show rule name=all.
You can return specific rule(s) using the Name
or LiteralName
parameters. The Name
parameter accepts wildcards; LiteralName
does not. There can be multiple firewall rules with the same name.
If the firewall isn't configurable/running, writes an error and returns without returning any objects.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Name | String | The name of the rule. Wildcards supported. Names aren't unique, so you may still get back multiple rules |
true | false | |
LiteralName | String | The literal name of the rule. Wildcards not supported. |
true | false |
Carbon.Firewall.Rule.
Get-FirewallRule
Demonstrates how to get the firewall rules running on the current computer.
Get-FirewallRule -Name 'World Wide Web Services (HTTP Traffic-In)'
Demonstrates how to get a specific rule.
Get-FirewallRule -Name '*HTTP*'
Demonstrates how to use wildcards to find rules whose names match a wildcard pattern, in this case any rule whose name contains the text 'HTTP' is returned.
Get-FirewallRule -LiteralName 'Custom Rule **CREATED BY AUTOMATED PROCES'
Demonstrates how to find a specific firewall rule by name if that name has wildcard characters in it.