COMMAND EVERYTHING.
Modifies existing Hyper-V firewall rules.
Microsoft NetSecurity reference: Modifies existing Hyper-V firewall rules. The syntax and selected example below are adapted from the pinned Windows Server 2025 reference. Module availability, target configuration and delegated permissions determine whether it can run in your environment. Documentation and parameter text: Microsoft, CC BY 4.0; formatting adapted by Cmdlet World. No execution testing is claimed.
Use an account with the target resource permissions documented for Set-NetFirewallHyperVRule. Modifying administrative cmdlets may require elevation or delegated administration. This catalog does not assert that ordinary users can execute the command.
Windows / NetSecurity · Windows Server 2025 documentation; feature/module prerequisites apply
-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.
-AsJob- Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.
-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.
-Confirm- Prompts you for confirmation before running the cmdlet.
-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.
-DisplayName (required)- Specifies that only matching Hyper-V firewall rules of the indicated display name are updated.
-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.
-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: - Single IPv4 Address: 1.2.3.4 - Single IPv6 Address: fe80::1 - IPv4 Subnet (by network bit count): 1.2.3.4/24 - IPv6 Subnet (by network bit count): fe80::1/48 - IPv4 Subnet (by network mask): 1.2.3.4/255.255.255.0 - IPv4 Range: 1.2.3.4-1.2.3.7 - IPv6 Range: fe80::1-fe80::9
-LocalPorts- 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
-Name- Specifies that only matching Hyper-V firewall rules of the indicated name are updated.
-NewDisplayName- Updates the DisplayName of the matching Hyper-V firewall rules.
-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.
-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.
-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: - Single IPv4 Address: 1.2.3.4 - Single IPv6 Address: fe80::1 - IPv4 Subnet (by network bit count): 1.2.3.4/24 - IPv6 Subnet (by network bit count): fe80::1/48 - IPv4 Subnet (by network mask): 1.2.3.4/255.255.255.0 - IPv4 Range: 1.2.3.4-1.2.3.7 - IPv6 Range: fe80::1-fe80::9
-RemotePorts- 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
-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.
-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.
-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}'.
-WhatIf- Shows what would happen if the cmdlet runs. The cmdlet is not run.
Windows with the NetSecurity module and the Windows feature or management tools that provide it. Confirm target connectivity and version compatibility using the linked Microsoft reference.
This cmdlet changes system state. Review every target and parameter in the official reference, test outside production, and prepare an appropriate backup or rollback. Do not execute the example automatically.