The Set-NetFirewallHyperVRule cmdlet modifies existing Hyper-V firewall rule properties. This cmdlet gets one or more rules to be modified using the Name parameter or the DisplayName parameter.
Rules cannot be queried by property in this cmdlet, but the querying can be done by the Get-NetFirewallHyperVRule cmdlet and piped into this cmdlet. The remaining parameters modify the properties of the specified rules.
Examples
EXAMPLE 1
PS C:\> Set-NetFirewallHyperVRule -Name DisplayName "Block Outbound to My Servers" -RemoteAddresses "10.0.0.0/32"
This example modifies the existing Hyper-V firewall rules with DisplayName "Block Outbound to My Servers" and updates the RemoteAddresses condition.
Parameters
-Action
Updates the Action value for the matching Hyper-V firewall rules.
This parameter specifies the action to take on traffic that matches this rule.
The acceptable values for this parameter are: Allow or Block.
Allow: Network packets that match all criteria specified in this rule are permitted through the firewall.
This is the default value.
Block: Network packets that match all criteria specified in this rule are dropped by the firewall.
Parameter properties
Type:
Action
Default value:
None
Accepted values:
NotConfigured, Allow, Block
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-AsJob
Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.
Parameter properties
Type:
SwitchParameter
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-CimSession
Runs the cmdlet in a remote session or on a remote computer.
Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet.
The default is the current session on the local computer.
Parameter properties
Type:
CimSession[]
Default value:
None
Supports wildcards:
False
DontShow:
False
Aliases:
Session
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type:
SwitchParameter
Default value:
False
Supports wildcards:
False
DontShow:
False
Aliases:
cf
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Direction
Updates the Direction value for the matching Hyper-V firewall rules.
This parameter specifies which direction of traffic to match with this rule.
The acceptable values for this parameter are: Inbound or Outbound.
Parameter properties
Type:
Direction
Default value:
Inbound
Accepted values:
Inbound, Outbound
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-DisplayName
Specifies that only matching Hyper-V firewall rules of the indicated display name are updated.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Enabled
Updates the Enabled value of the matching Hyper-V firewall rules.
This parameter specifies that the rule object is administratively enabled or administratively disabled.
The acceptable values for this parameter are:
True: Specifies the rule is currently enabled.
False: Specifies the rule is currently disabled.
Note that the type of this parameter is not Boolean, therefore $true and $false variables are not acceptable values here. Use "True" and "False" text strings instead.
A disabled rule will not actively modify computer behavior, but the management construct still exists on the computer so it can be re-enabled.
Parameter properties
Type:
Enabled
Default value:
True
Accepted values:
True, False
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-LocalAddresses
Updates the LocalAddresses value for the matching Hyper-V firewall rules.
This parameter specifies that network packets with matching IP addresses match this rule.
This parameter value is an IPv4 or IPv6 address, hostname, subnet, or range.
The acceptable formats for this parameter are:
Updates the LocalPorts value for the matching Hyper-V firewall rules.
This parameter specifies that network packets with matching IP local port numbers match this rule.
The acceptable values are:
Port range: 0-65535
Port number: 80
Parameter properties
Type:
String[]
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Name
Specifies that only matching Hyper-V firewall rules of the indicated name are updated.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Aliases:
ID
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-NewDisplayName
Updates the DisplayName of the matching Hyper-V firewall rules.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Profiles
Specifies one or more profiles to which the hyper-v firewall rule is assigned.
The rule is active on the local computer only when the specified profile is currently active.
This relationship is many-to-many and can be indirectly modified by the user, by changing the Profiles field on instances of rules.
Only one profile is applied at a time.
The acceptable values for this parameter are: Any, Domain, Private, Public, or NotApplicable.
The default value is Any.
Separate multiple entries with a comma and do not include any spaces.
Parameter properties
Type:
Profiles
Default value:
Any
Accepted values:
Any, Domain, Private, Public, NotApplicable
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Protocol
Updates the protocol value of the matching Hyper-V firewall rules.
This parameter specifies that network packets with matching IP protocol match this rule.
The acceptable values for this parameter are:
Protocols by number: 0-255.
Protocols by name: TCP, UDP, ICMPv4, or ICMPv6.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-RemoteAddresses
Updates the RemoteAddresses value of the matching Hyper-V firewall rules.
This parameter specifies that network packets with matching IP addresses match this rule.
This parameter value is an IPv4 or IPv6 address, subnet, or range.
The acceptable formats for this parameter are:
Updates the RemotePorts value of the matching Hyper-V firewall rules.
This parameter specifies that network packets with matching IP port numbers match this rule.
The acceptable values are:
Port range: 0-65535
Port number: 80
Parameter properties
Type:
String[]
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-RulePriority
Updates the RulePriority value of the matching Hyper-V firewall rules.
This parameter specifies the order in which rules are evaluated. A lower priority rule is evaluated before a higher priority rule.
Parameter properties
Type:
uint16
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-ThrottleLimit
Specifies the maximum number of concurrent operations that can be established to run the cmdlet.
If this parameter is omitted or a value of 0 is entered, Windows PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer.
The throttle limit applies only to the current cmdlet, not to the session or to the computer.
Parameter properties
Type:
Int32
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-VMCreatorId
Updates the VMCreatorId value of the matching Hyper-V firewall rules.
This parameter specifies that network packets originating from a VM matching this VMCreatorId matches this rule. The format for this value is a GUID enclosed in brackets: '{9E288F02-CE00-4D9E-BE2B-14CE463B0298}'.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Parameter properties
Type:
SwitchParameter
Default value:
False
Supports wildcards:
False
DontShow:
False
Aliases:
wi
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.
The Microsoft.Management.Infrastructure.CimInstance object is a wrapper class that displays Windows Management Instrumentation (WMI) objects.
The path after the pound sign (#) provides the namespace and class name for the underlying WMI object.