API Reference
Command
Set-CxFirewallProfile
Applies Windows Firewall profile settings for one or more firewall profiles.
Examples
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
- Profile flags: Domain, Private, Public (or All). Possible values: Domain, Private, Public, All
- Possible values:
Domain,Private,Public,All - Enabled bool
- True to enable, false to disable. If omitted, the firewall Enabled state is not changed.
- AllowLocalFirewallRules bool
- Controls whether local firewall rules remain effective for the selected profiles.
- DisableNotifications bool
- Controls whether Windows Firewall notifications are suppressed for the selected profiles.
- LogDroppedPackets bool
- When set, records dropped packets in the firewall log.
- LogFilePath string
- Log file path to apply to the selected firewall profiles.
- LogFileSizeKB int
- Maximum firewall log size, in kilobytes.
- LogSuccessfulConnections bool
- When set, records successful connections in the firewall log.
- PassThru SwitchParameter
- When set, outputs the detailed result object instead of a simple success boolean.
- Policy SwitchParameter
- Writes logging settings to the policy-backed firewall path instead of the operational path.
Outputs
ComputerX.Firewall.FirewallProfileApplyResult, System.Boolean