PowerShell Logo Small

Get-NetFirewallRule



This is the built-in help made by Microsoft for the command 'Get-NetFirewallRule', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 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.

SYNOPSIS

Retrieves firewall rules from the target computer.

SYNTAX


Get-NetFirewallRule [-Action <Action[]>] [-AsJob] [-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] [<CommonParameters>]
Get-NetFirewallRule [-All] [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore]
[<CommonParameters>]
Get-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore]
-AssociatedNetFirewallInterfaceFilter <CimInstance> [<CommonParameters>]
Get-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore]
-AssociatedNetFirewallInterfaceTypeFilter <CimInstance> [<CommonParameters>]
Get-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore]
-AssociatedNetFirewallAddressFilter <CimInstance> [<CommonParameters>]
Get-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore] -DisplayName <String[]>
[<CommonParameters>]
Get-NetFirewallRule [-Name] <String[]> [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore]
[<CommonParameters>]
Get-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore]
-AssociatedNetFirewallApplicationFilter <CimInstance> [<CommonParameters>]
Get-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore]
-AssociatedNetFirewallProfile <CimInstance> [<CommonParameters>]
Get-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore]
-AssociatedNetFirewallServiceFilter <CimInstance> [<CommonParameters>]
Get-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore]
-AssociatedNetFirewallSecurityFilter <CimInstance> [<CommonParameters>]
Get-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore]
-AssociatedNetFirewallPortFilter <CimInstance> [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


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.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkId=285411
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

REMARKS

<

Examples


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.