TestimoX

API Reference

Command

Set-CxFirewallProfile

Namespace ComputerX.PowerShell
Outputs
ComputerX.Firewall.FirewallProfileApplyResult System.Boolean

Applies Windows Firewall profile settings for one or more firewall profiles.

Examples

Authored help example

Example 1: Enables the public firewall profile and returns the detailed apply result.

PS>


Set-CxFirewallProfile -Profile Public -Enabled $true -PassThru
        

Example 2: Configures domain profile logging under the policy path for a hardened baseline.

PS>


Set-CxFirewallProfile -Profile Domain -LogFilePath '%systemroot%\system32\LogFiles\Firewall\pfirewall.log' -LogDroppedPackets $true -LogSuccessfulConnections $true -Policy
        

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

Set-CxFirewallProfile -Profile <Domain|Private|Public|All> [-Enabled <bool>] [-AllowLocalFirewallRules <bool>] [-DisableNotifications <bool>] [-LogDroppedPackets <bool>] [-LogFilePath <string>] [-LogFileSizeKB <int>] [-LogSuccessfulConnections <bool>] [-PassThru] [-Policy] [<CommonParameters>]
#

Parameters

Profile FirewallProfileKind requiredposition: 0pipeline: falsevalues: 4
Profile flags: Domain, Private, Public (or All). Possible values: Domain, Private, Public, All
Possible values: Domain, Private, Public, All
Enabled bool optionalposition: 1pipeline: false
True to enable, false to disable. If omitted, the firewall Enabled state is not changed.
AllowLocalFirewallRules bool optionalposition: namedpipeline: false
Controls whether local firewall rules remain effective for the selected profiles.
DisableNotifications bool optionalposition: namedpipeline: false
Controls whether Windows Firewall notifications are suppressed for the selected profiles.
LogDroppedPackets bool optionalposition: namedpipeline: false
When set, records dropped packets in the firewall log.
LogFilePath string optionalposition: namedpipeline: false
Log file path to apply to the selected firewall profiles.
LogFileSizeKB int optionalposition: namedpipeline: false
Maximum firewall log size, in kilobytes.
LogSuccessfulConnections bool optionalposition: namedpipeline: false
When set, records successful connections in the firewall log.
PassThru SwitchParameter optionalposition: namedpipeline: false
When set, outputs the detailed result object instead of a simple success boolean.
Policy SwitchParameter optionalposition: namedpipeline: false
Writes logging settings to the policy-backed firewall path instead of the operational path.

Outputs

ComputerX.Firewall.FirewallProfileApplyResult, System.Boolean