Enables one or more Hyper-V firewall rules that match the specified criteria.
Networking / Security · Risk: High · Documentation Verified
Last verified: 2026-10-26
Microsoft NetSecurity reference: Enables one or more Hyper-V firewall rules that match the specified criteria. 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 Enable-NetFirewallHyperVRule. Modifying administrative cmdlets may require elevation or delegated administration. This catalog does not assert that ordinary users can execute the command.
Supported environments
Windows / NetSecurity · Windows Server 2025 documentation; feature/module prerequisites apply
Parameters
-Action
Specifies that matching Hyper-V firewall rules of the indicated action are enable. 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.
-Direction
Specifies that matching Hyper-V firewall rules of the indicated direction are enabled. 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 enabled. Wildcard characters are accepted.
-Enabled
Specifies that matching Hyper-V firewall rules of the indicated state are enabled. 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.
-EnforcementStatus
Specifies that firewall rules that match the indicated enforcement status are enabled. This parameter specifies the overall status of the rule. - OK: Specifies that the rule will work as specified. - PartiallyEnforced: Specifies that one or more parts of the rule will not be enforced. - NoApplicablePorts: Specifies that the rule is functioning as expected, but there are no ports applicable for this rule and therefore is not active. - ParsingError: Specifies that the rule is corrupted and the computer is unable to use the rule at all. - Error: Specifies that the computer is unable to use the rule at all.
-Name
Specifies that only matching Hyper-V firewall rules of the indicated name are enabled. This name serves as the unique identifier for this rule. This parameter acts just like a file name, in that only one rule with a given name may exist in a policy store at a time.
-PolicyStore
Targets the policy store from which to enable the rules. A policy store is a container for firewall policy. The acceptable values for this parameter are: - PersistentStore: Sometimes called static rules, this store contains the persistent policy for the local computer. This policy is not from GPOs, and has been created manually or programmatically (during application installation) on the computer. Rules created in this store are attached to the ActiveStore and activated on the computer immediately. - ActiveStore: This store contains the currently active policy, which is the sum of all policy stores that apply to the computer. - SystemDefaults: This read-only store contains the default state of firewall rules. - MDM: This store contains the rules configured via MDM. By default, the PersistentStore is queried.
-PolicyStoreSourceType
Specifies that Hyper-V firewall rules that match the indicated policy store source type are enabled. This parameter value is automatically generated and should not be modified. The acceptable values for this parameter are: - Local: The object originates from the local store. - MDM: The object originates from the MDM store. By default, the Local store is queried.
-Protocol
Specifies that only matching Hyper-V firewall rules with the indicated protocol are enabled. The acceptable values for this parameter are: - Protocols by number: 0-255. - Protocols by name: TCP, UDP, ICMPv4, or ICMPv6.
-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
Specifies that only matching Hyper-V firewall rules with the specified VMCreatorId are enabled. The format for this value is a GUID enclosed in brackets, such as '{9E288F02-CE00-4D9E-BE2B-14CE463B0298}'.
Prerequisites
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.
Security considerations
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.
This example retrieves all the Hyper-V firewall rules in the active store, which is a collection of all the policy stores that apply to the computer, and enables all of them. Source: Microsoft, CC BY 4.0; transcript prompt/output removed. This example was not executed.