Skip to content

Set Firewall Rule

Creates a Windows Firewall rule if it does not exist, or updates the existing rule when found by Name. You can use Get-NetFirewallRule -All to see all rules.

Required

Internal firewall rule name (rule ID). Used to detect whether the rule already exists.

Optional

Friendly display name for the firewall rule. If empty, Name is used.

Optional

Optional description for the firewall rule.

Optional — Default: Inbound

Traffic direction for the firewall rule. Allowed values: Inbound, Outbound.

Optional — Default: Allow

Firewall action for matching traffic. Allowed values: Allow, Block.

Optional — Default: True

Set rule state to enabled (True) or disabled (False). Allowed values: True, False.

Optional — Default: Any

Firewall profile scope where the rule applies. Allowed values: Domain, Private, Public, Any.

Optional — Default: Any

Interface type where the firewall rule applies. Allowed values: Any, Wired, Wireless, RemoteAccess.

Optional

Optional executable path used for the firewall rule.

Optional

Optional local address filter for the firewall rule. The value can be an IPv4 or IPv6 address, hostname, subnet, range, or the keyword Any. Examples: Any, 127.0.0.1, 192.168.1.10, 192.168.1.0/24, LocalSubnet, or fe80::1.

Optional

Optional remote address filter for the firewall rule. The value can be an IPv4 or IPv6 address, hostname, subnet, range, or supported keywords such as Any, LocalSubnet, DNS, DHCP, Internet, or Intranet. Examples: Any, 10.0.0.15, 10.0.0.0/24, LocalSubnet, or fe80::1.

Optional

Optional local port filter for the firewall rule. Examples: 80, 443, 5000-5010, or Any. Use this when Protocol is TCP or UDP. Leave empty when Protocol is Any, ICMPv4, or ICMPv6.

Optional — Default: Any

Optional protocol for the firewall rule. Allowed values: Any, TCP, UDP, ICMPv4, ICMPv6.

  • Category: System
  • Brick ID: FirewallRule-Set