PowerShell Logo Small

Copy-NetFirewallRule



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

SYNOPSIS

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

SYNTAX


Copy-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[]>] [-NewGPOSession <String>] [-NewName <String>] [-NewPolicyStore
<String>] [-Owner <String[]>] [-PassThru [<SwitchParameter>]] [-PolicyStore <String>] [-PolicyStoreSource <String[]>] [-PolicyStoreSourceType
<PolicyStoreType[]>] [-PrimaryStatus <PrimaryStatus[]>] [-Status <String[]>] [-ThrottleLimit <Int32>] [-TracePolicyStore [<SwitchParameter>]]
[-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]
Copy-NetFirewallRule [-All [<SwitchParameter>]] [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>]
[-NewGPOSession <String>] [-NewName <String>] [-NewPolicyStore <String>] [-PassThru [<SwitchParameter>]] [-PolicyStore <String>]
[-ThrottleLimit <Int32>] [-TracePolicyStore [<SwitchParameter>]] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]
[<CommonParameters>]
Copy-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName
<String>] [-NewPolicyStore <String>] [-PassThru [<SwitchParameter>]] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore
[<SwitchParameter>]] -AssociatedNetFirewallSecurityFilter <CimInstance> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]
[<CommonParameters>]
Copy-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName
<String>] [-NewPolicyStore <String>] [-PassThru [<SwitchParameter>]] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore
[<SwitchParameter>]] -DisplayName <String[]> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]
Copy-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-NewGPOSession <String>] [-NewName <String>] [-NewPolicyStore
<String>] [-PassThru [<SwitchParameter>]] [-ThrottleLimit <Int32>] -InputObject <CimInstance[]> [-Confirm [<SwitchParameter>]] [-WhatIf
[<SwitchParameter>]] [<CommonParameters>]
Copy-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName
<String>] [-NewPolicyStore <String>] [-PassThru [<SwitchParameter>]] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore
[<SwitchParameter>]] -AssociatedNetFirewallProfile <CimInstance> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]
[<CommonParameters>]
Copy-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName
<String>] [-NewPolicyStore <String>] [-PassThru [<SwitchParameter>]] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore
[<SwitchParameter>]] -AssociatedNetFirewallServiceFilter <CimInstance> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]
[<CommonParameters>]
Copy-NetFirewallRule [-Name] <String[]> [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession
<String>] [-NewName <String>] [-NewPolicyStore <String>] [-PassThru [<SwitchParameter>]] [-PolicyStore <String>] [-ThrottleLimit <Int32>]
[-TracePolicyStore [<SwitchParameter>]] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]
Copy-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName
<String>] [-NewPolicyStore <String>] [-PassThru [<SwitchParameter>]] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore
[<SwitchParameter>]] -AssociatedNetFirewallPortFilter <CimInstance> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]
[<CommonParameters>]
Copy-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName
<String>] [-NewPolicyStore <String>] [-PassThru [<SwitchParameter>]] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore
[<SwitchParameter>]] -AssociatedNetFirewallInterfaceTypeFilter <CimInstance> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]
[<CommonParameters>]
Copy-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName
<String>] [-NewPolicyStore <String>] [-PassThru [<SwitchParameter>]] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore
[<SwitchParameter>]] -AssociatedNetFirewallInterfaceFilter <CimInstance> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]
[<CommonParameters>]
Copy-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName
<String>] [-NewPolicyStore <String>] [-PassThru [<SwitchParameter>]] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore
[<SwitchParameter>]] -AssociatedNetFirewallApplicationFilter <CimInstance> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]
[<CommonParameters>]
Copy-NetFirewallRule [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-GPOSession <String>] [-NewGPOSession <String>] [-NewName
<String>] [-NewPolicyStore <String>] [-PassThru [<SwitchParameter>]] [-PolicyStore <String>] [-ThrottleLimit <Int32>] [-TracePolicyStore
[<SwitchParameter>]] -AssociatedNetFirewallAddressFilter <CimInstance> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]
[<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

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.