This is the built-in help made by Microsoft for the command 'Get-NetFirewallRule', in PowerShell version 3 - as retrieved from
Windows version 'Microsoft Windows Server 2012 Standard' PowerShell help files on 2016-06-23.
For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.
Retrieves firewall rules from the target computer.
Get-NetFirewallRule [-Action <Action[]>] [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-Description <String[]>] [-Direction
<Direction[]>] [-DisplayGroup <String[]>] [-EdgeTraversalPolicy <EdgeTraversal[]>] [-Enabled <Enabled[]>] [-GPOSession <String>] [-Group
<String[]>] [-LocalOnlyMapping <Boolean[]>] [-LooseSourceMapping <Boolean[]>] [-Owner <String[]>] [-PolicyStore <String>] [-PolicyStoreSource
<String[]>] [-PolicyStoreSourceType <PolicyStoreType[]>] [-PrimaryStatus <PrimaryStatus[]>] [-Status <String[]>] [-ThrottleLimit <Int32>]
[-TracePolicyStore [<SwitchParameter>]] [<CommonParameters>]
Get-NetFirewallRule [-All [<SwitchParameter>]] [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore
<String>] [-ThrottleLimit <Int32>] [-TracePolicyStore [<SwitchParameter>]] [<CommonParameters>]
Get-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit
<Int32>] [-TracePolicyStore [<SwitchParameter>]] -AssociatedNetFirewallPortFilter <CimInstance> [<CommonParameters>]
Get-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit
<Int32>] [-TracePolicyStore [<SwitchParameter>]] -AssociatedNetFirewallAddressFilter <CimInstance> [<CommonParameters>]
Get-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit
<Int32>] [-TracePolicyStore [<SwitchParameter>]] -AssociatedNetFirewallInterfaceTypeFilter <CimInstance> [<CommonParameters>]
Get-NetFirewallRule [-Name] <String[]> [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore
<String>] [-ThrottleLimit <Int32>] [-TracePolicyStore [<SwitchParameter>]] [<CommonParameters>]
Get-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit
<Int32>] [-TracePolicyStore [<SwitchParameter>]] -AssociatedNetFirewallProfile <CimInstance> [<CommonParameters>]
Get-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit
<Int32>] [-TracePolicyStore [<SwitchParameter>]] -AssociatedNetFirewallServiceFilter <CimInstance> [<CommonParameters>]
Get-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit
<Int32>] [-TracePolicyStore [<SwitchParameter>]] -AssociatedNetFirewallSecurityFilter <CimInstance> [<CommonParameters>]
Get-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit
<Int32>] [-TracePolicyStore [<SwitchParameter>]] -AssociatedNetFirewallInterfaceFilter <CimInstance> [<CommonParameters>]
Get-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit
<Int32>] [-TracePolicyStore [<SwitchParameter>]] -AssociatedNetFirewallApplicationFilter <CimInstance> [<CommonParameters>]
Get-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit
<Int32>] [-TracePolicyStore [<SwitchParameter>]] -DisplayName <String[]> [<CommonParameters>]
The Get-NetFirewallRule cmdlet returns the instances of firewall rules that match the search parameters from the user. See the
New-NetFirewallRule cmdlet for more information.
This cmdlet returns one or more firewall rules by specifying the Name parameter (default), the DisplayName parameter, rule properties, or by
associated filters or objects. The queried rules can be placed into variables and piped to other cmdlets for further modifications or
monitoring.
When running the cmdlet with the Get verb for any firewall, IPsec, or main mode rule, notice that the common conditions like addresses or
ports do not appear. These conditions are represented in separate objects called filters. The filter-to-rule relationship is always one-to-one
and is managed automatically. If a query for rules based on these parameters (ports, addresses, security, interfaces, and services) is
performed, then the filter objects with the corresponding cmdlet with the Get verb should to be retrieved. See the
Get-NetFirewallAddressFilter, Get-NetFirewallApplicationFilter, Get-NetFirewallInterfaceFilter, Get-NetFirewallInterfaceTypeFilter,
Get-NetFirewallPortFilter, Get-NetFirewallProfile, Get-NetFirewallSecurityFilter, Get-NetFirewallServiceFilter, or Get-NetFirewallRule cmdlet
for more information.
<
Copy-NetFirewallRule
Get-NetFirewallAddressFilter
Get-NetFirewallApplicationFilter
Get-NetFirewallInterfaceFilter
Get-NetFirewallInterfaceTypeFilter
Get-NetFirewallPortFilter
Get-NetFirewallProfile
Get-NetFirewallRule
Get-NetFirewallSecurityFilter
Get-NetFirewallServiceFilter
New-NetFirewallRule
Open-NetGPO
Save-NetGPO
Set-NetFirewallRule
Set-NetFirewallServiceFilter
New-GPO
<
EXAMPLE 1
PS C:\> Get-NetFirewallRule -PolicyStore ActiveStore
This example retrieves all of the firewall rules in the active store, which is a collection of all of the policy stores that apply to the
computer. Running this cmdlet without specifying the policy store retrieves the persistent store.
EXAMPLE 2
PS C:\> Get-NetFirewallProfile -Name Public | Get-NetFirewallRule
This example retrieves all of the firewall rules scoped to the public profile.
EXAMPLE 3
PS C:\> $nfServiceFilter = Get-NetFirewallRule –Group "@FirewallAPI.dll,-30502" | Get-NetFirewallServiceFilter -Service Any
PS C:\> Set-NetFirewallServiceFilter –Service Ssdpsrv –InputObject $nfServiceFilter
This cmdlet can be run using only the pipeline.
PS C:\> Get-NetFirewallRule –Group "@FirewallAPI.dll,-30502" | Get-NetFirewallServiceFilter -Service Any | Set-NetFirewallServiceFilter
–Service Ssdpsrv
This example modifies the service associated with firewall rules in a specified group.