PowerShell Logo Small

Copy-NetFirewallRule



This is the built-in help made by Microsoft for the command 'Copy-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

Copies an entire firewall rule, and associated filters, to the same or to a different policy store.

SYNTAX


Copy-NetFirewallRule [-Action <Action[]>] [-AsJob] [-CimSession <CimSession[]>] [-Description <String[]>] [-Direction <Direction[]>] [-DisplayGroup <String[]>]
[-EdgeTraversalPolicy <EdgeTraversal[]>] [-Enabled <Enabled[]>] [-GPOSession <String>] [-Group <String[]>] [-LocalOnlyMapping <Boolean[]>] [-LooseSourceMapping <Boolean[]>]
[-NewGPOSession <String>] [-NewName <String>] [-NewPolicyStore <String>] [-Owner <String[]>] [-PassThru] [-PolicyStore <String>] [-PolicyStoreSource <String[]>]
[-PolicyStoreSourceType <PolicyStoreType[]>] [-PrimaryStatus <PrimaryStatus[]>] [-Status <String[]>] [-ThrottleLimit <Int32>] [-TracePolicyStore] [-Confirm] [-WhatIf]
[<CommonParameters>]
Copy-NetFirewallRule [-All] [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName <String>] [-NewPolicyStore <String>] [-PassThru]
[-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore] [-Confirm] [-WhatIf] [<CommonParameters>]
Copy-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName <String>] [-NewPolicyStore <String>] [-PassThru]
[-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore] -AssociatedNetFirewallInterfaceTypeFilter <CimInstance> [-Confirm] [-WhatIf] [<CommonParameters>]
Copy-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName <String>] [-NewPolicyStore <String>] [-PassThru]
[-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore] -DisplayName <String[]> [-Confirm] [-WhatIf] [<CommonParameters>]
Copy-NetFirewallRule [-Name] <String[]> [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName <String>] [-NewPolicyStore <String>]
[-PassThru] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore] [-Confirm] [-WhatIf] [<CommonParameters>]
Copy-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName <String>] [-NewPolicyStore <String>] [-PassThru]
[-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore] -AssociatedNetFirewallServiceFilter <CimInstance> [-Confirm] [-WhatIf] [<CommonParameters>]
Copy-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName <String>] [-NewPolicyStore <String>] [-PassThru]
[-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore] -AssociatedNetFirewallAddressFilter <CimInstance> [-Confirm] [-WhatIf] [<CommonParameters>]
Copy-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-NewGPOSession <String>] [-NewName <String>] [-NewPolicyStore <String>] [-PassThru] [-ThrottleLimit <Int32>]
-InputObject <CimInstance[]> [-Confirm] [-WhatIf] [<CommonParameters>]
Copy-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName <String>] [-NewPolicyStore <String>] [-PassThru]
[-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore] -AssociatedNetFirewallProfile <CimInstance> [-Confirm] [-WhatIf] [<CommonParameters>]
Copy-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName <String>] [-NewPolicyStore <String>] [-PassThru]
[-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore] -AssociatedNetFirewallSecurityFilter <CimInstance> [-Confirm] [-WhatIf] [<CommonParameters>]
Copy-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName <String>] [-NewPolicyStore <String>] [-PassThru]
[-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore] -AssociatedNetFirewallPortFilter <CimInstance> [-Confirm] [-WhatIf] [<CommonParameters>]
Copy-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName <String>] [-NewPolicyStore <String>] [-PassThru]
[-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore] -AssociatedNetFirewallInterfaceFilter <CimInstance> [-Confirm] [-WhatIf] [<CommonParameters>]
Copy-NetFirewallRule [-AsJob] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName <String>] [-NewPolicyStore <String>] [-PassThru]
[-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore] -AssociatedNetFirewallApplicationFilter <CimInstance> [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Copy-NetFirewallRule cmdlet copies a firewall rule and associated filters to a policy store, making a complete clone. When a new policy store is not specified, a
firewall rule is copied to the same policy store with a new name specified by the user.


This cmdlet returns one or more firewall rules to be duplicated by specifying the Name parameter (default), the DisplayName parameter, the rule properties, or by associated
filters or objects. The resulting queried rule is copied to a new policy store using the NewPolicyStore parameter, a new Group Policy Object (GPO) session using the
NewGPOSession parameter, or to the same policy store using the NewName parameter. Note: Only one firewall rule can be copied at a time when copying to the same policy store.
This is because only a single firewall rule can use the unique identifier, or name, specified by the NewName parameter.


When copying a rule to a new policy store, the unique name of the set is preserved. This means that if the same set is copied twice, then the second attempt returns an error
that the object already exists. To overwrite the target set, first run the Remove-NetFirewallRule cmdlet. If the object may already exist, then use the ErrorAction parameter
to silently ignore these errors instead of running the Remove-NetFirewallRule cmdlet.


The associated filters (NetFirewallAddressFilter, NetFirewallApplicationFilter, and so on) have a one-to-one correspondence with each firewall rule and there is no need to
copy the filter objects. For more information on filters, see the Get-NetFirewallRule cmdlet.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkId=216649
Disable-NetFirewallRule
Enable-NetFirewallRule
Get-NetFirewallRule
New-NetFirewallRule
Remove-NetFirewallRule
Rename-NetFirewallRule
Set-NetFirewallRule
Show-NetFirewallRule

REMARKS

<

Examples


EXAMPLE 1

PS C:\>Copy-NetFirewallRule -DisplayName "Require Outbound Authentication" –NewName "Alternate Require Outbound Authentication"



This example copies a firewall rule, found using the localized name, to the current policy store under a new unique identifier. The localized DisplayName parameter value
remains the same.




EXAMPLE 2

PS C:\>Copy-NetFirewallRule -Group "@FirewallAPI.dll,-36501" –Enabled False –PolicyStore domain.contoso.com\GPO_name –NewPolicyStore domain.contoso.com\new_gpo



This example copies a group of firewall rules that are currently disabled to a new policy store.




EXAMPLE 3

PS C:\>Get-NetFirewallProfile -Profile Domain –PolicyStore domain.contoso.com\GPO_name | Copy-NetFirewallRule –NewPolicyStore domain.example.com\new_gpo



This example copies all of the domain firewall rules of a specified GPO to a new policy store.