API Reference
FirewallRuleActions
Actions to enable/disable Windows Firewall rules by display name. Local machine only.
Inheritance
- Object
- FirewallRuleActions
Methods
public static FirewallRuleCreateResult Create(FirewallRuleSpec spec) #FirewallRuleCreateResultCreates a firewall rule based on the provided specification.
Parameters
- spec ComputerX.Firewall.FirewallRuleSpec
public static Boolean CreateInboundProgramRule(String name, String program, Boolean allow, FirewallProfileKind profiles, FirewallProtocol protocol = Any) #BooleanCreates an inbound program rule with optional protocol (6=TCP,17=UDP,256=Any). No explicit ports.
Parameters
- name System.String
- program System.String
- allow System.Boolean
- profiles System.Int32 = 7
- protocol System.Int32 = Any
CreateInboundProgramRule(System.String name, System.String program, System.Boolean allow, ComputerX.Firewall.FirewallProfileKind profiles, ComputerX.Firewall.FirewallProtocol protocol) #Typed overload for Int32) using enums.
Parameters
- name System.String
- program System.String
- allow System.Boolean
- profiles ComputerX.Firewall.FirewallProfileKind
- protocol ComputerX.Firewall.FirewallProtocol
public static Boolean CreateInboundTcpRule(String name, Int32 localPort, Boolean allow, FirewallProfileKind profiles, String program = null) #BooleanCreates an inbound TCP rule (Allow or Block) for a local port. Optional program and profile mask. Profiles: 1=Domain, 2=Private, 4=Public, 7=All.
Parameters
- name System.String
- localPort System.Int32
- allow System.Boolean
- profiles System.Int32 = 7
- program System.String = null
CreateInboundTcpRule(System.String name, System.Int32 localPort, System.Boolean allow, ComputerX.Firewall.FirewallProfileKind profiles, System.String program) #Typed overload for String) using FirewallProfileKind.
Parameters
- name System.String
- localPort System.Int32
- allow System.Boolean
- profiles ComputerX.Firewall.FirewallProfileKind
- program System.String
public static Boolean CreateInboundTcpRuleRange(String name, String localPortSpec, Boolean allow, FirewallProfileKind profiles, String program = null) #BooleanCreates an inbound TCP rule for a local port range/list (e.g., "5000-5010, 6000").
Parameters
- name System.String
- localPortSpec System.String
- allow System.Boolean
- profiles System.Int32 = 7
- program System.String = null
CreateInboundTcpRuleRange(System.String name, System.String localPortSpec, System.Boolean allow, ComputerX.Firewall.FirewallProfileKind profiles, System.String program) #Typed overload for String) using FirewallProfileKind.
Parameters
- name System.String
- localPortSpec System.String
- allow System.Boolean
- profiles ComputerX.Firewall.FirewallProfileKind
- program System.String
public static Boolean CreateInboundUdpRule(String name, Int32 localPort, Boolean allow, FirewallProfileKind profiles, String program = null) #BooleanCreates an inbound UDP rule (Allow or Block) for a local port.
Parameters
- name System.String
- localPort System.Int32
- allow System.Boolean
- profiles System.Int32 = 7
- program System.String = null
CreateInboundUdpRule(System.String name, System.Int32 localPort, System.Boolean allow, ComputerX.Firewall.FirewallProfileKind profiles, System.String program) #Typed overload for String) using FirewallProfileKind.
Parameters
- name System.String
- localPort System.Int32
- allow System.Boolean
- profiles ComputerX.Firewall.FirewallProfileKind
- program System.String
public static Boolean CreateInboundUdpRuleRange(String name, String localPortSpec, Boolean allow, FirewallProfileKind profiles, String program = null) #BooleanCreates an inbound UDP rule for a local port range/list.
Parameters
- name System.String
- localPortSpec System.String
- allow System.Boolean
- profiles System.Int32 = 7
- program System.String = null
CreateInboundUdpRuleRange(System.String name, System.String localPortSpec, System.Boolean allow, ComputerX.Firewall.FirewallProfileKind profiles, System.String program) #Typed overload for String) using FirewallProfileKind.
Parameters
- name System.String
- localPortSpec System.String
- allow System.Boolean
- profiles ComputerX.Firewall.FirewallProfileKind
- program System.String
public static Boolean CreateOutboundProgramRule(String name, String program, Boolean allow, FirewallProfileKind profiles, FirewallProtocol protocol = Any) #BooleanCreates an outbound program rule (Allow or Block) with protocol filter.
Parameters
- name System.String
- program System.String
- allow System.Boolean
- profiles System.Int32 = 7
- protocol System.Int32 = Any
CreateOutboundProgramRule(System.String name, System.String program, System.Boolean allow, ComputerX.Firewall.FirewallProfileKind profiles, ComputerX.Firewall.FirewallProtocol protocol) #Typed overload for Int32) using enums.
Parameters
- name System.String
- program System.String
- allow System.Boolean
- profiles ComputerX.Firewall.FirewallProfileKind
- protocol ComputerX.Firewall.FirewallProtocol
public static Boolean CreateOutboundTcpRule(String name, Int32 remotePort, Boolean allow, FirewallProfileKind profiles, String program = null) #BooleanCreates an outbound TCP rule for a single remote port.
Parameters
- name System.String
- remotePort System.Int32
- allow System.Boolean
- profiles System.Int32 = 7
- program System.String = null
CreateOutboundTcpRule(System.String name, System.Int32 remotePort, System.Boolean allow, ComputerX.Firewall.FirewallProfileKind profiles, System.String program) #Typed overload for String) using FirewallProfileKind.
Parameters
- name System.String
- remotePort System.Int32
- allow System.Boolean
- profiles ComputerX.Firewall.FirewallProfileKind
- program System.String
public static Boolean CreateOutboundTcpRuleRange(String name, String remotePortSpec, Boolean allow, FirewallProfileKind profiles, String program = null) #BooleanCreates an outbound TCP rule for a remote port range/list.
Parameters
- name System.String
- remotePortSpec System.String
- allow System.Boolean
- profiles System.Int32 = 7
- program System.String = null
CreateOutboundTcpRuleRange(System.String name, System.String remotePortSpec, System.Boolean allow, ComputerX.Firewall.FirewallProfileKind profiles, System.String program) #Typed overload for String) using FirewallProfileKind.
Parameters
- name System.String
- remotePortSpec System.String
- allow System.Boolean
- profiles ComputerX.Firewall.FirewallProfileKind
- program System.String
public static Boolean CreateOutboundUdpRule(String name, Int32 remotePort, Boolean allow, FirewallProfileKind profiles, String program = null) #BooleanCreates an outbound UDP rule for a single remote port.
Parameters
- name System.String
- remotePort System.Int32
- allow System.Boolean
- profiles System.Int32 = 7
- program System.String = null
CreateOutboundUdpRule(System.String name, System.Int32 remotePort, System.Boolean allow, ComputerX.Firewall.FirewallProfileKind profiles, System.String program) #Typed overload for String) using FirewallProfileKind.
Parameters
- name System.String
- remotePort System.Int32
- allow System.Boolean
- profiles ComputerX.Firewall.FirewallProfileKind
- program System.String
public static Boolean CreateOutboundUdpRuleRange(String name, String remotePortSpec, Boolean allow, FirewallProfileKind profiles, String program = null) #BooleanCreates an outbound UDP rule for a remote port range/list.
Parameters
- name System.String
- remotePortSpec System.String
- allow System.Boolean
- profiles System.Int32 = 7
- program System.String = null
CreateOutboundUdpRuleRange(System.String name, System.String remotePortSpec, System.Boolean allow, ComputerX.Firewall.FirewallProfileKind profiles, System.String program) #Typed overload for String) using FirewallProfileKind.
Parameters
- name System.String
- remotePortSpec System.String
- allow System.Boolean
- profiles ComputerX.Firewall.FirewallProfileKind
- program System.String
public static Int32 RemoveByName(String ruleName) #Int32Removes all rules with a matching display name. Returns number of removed rules.
Parameters
- ruleName System.String
public static Boolean SetRuleEnabled(String ruleName, Boolean enabled) #BooleanEnables or disables all rules that match the provided display name (case-insensitive). Returns true if any rule was updated.
Parameters
- ruleName System.String
- enabled System.Boolean
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object