# Ensure 'Windows Firewall: Private: Firewall state' is set to 'On (recommended)'

Necessity: The Windows Defender Firewall is a critical first line of defense against network-based threats. For the 'Private' profile, which applies to trusted networks like a home or office, the firewall prevents unauthorized access from other devices on the same network. A compromised device on a trusted network can attempt to spread malware or attack other systems. Leaving the firewall disabled exposes the system to significant internal threats, bypassing perimeter security. Auditing and Remediation: The audit script checks the 'Enabled' property of the 'Private' network profile using the 'Get-NetFirewallProfile' cmdlet to determine if the firewall is active. The remediation script uses the 'Set-NetFirewallProfile' cmdlet to enable or disable the firewall for this profile based on the provided input. Recommended State Rationale: The recommended state for all security levels (Basic, Moderate, Strict) is 'On'. Unlike settings with variable levels of security, the firewall's state is binary; it is either providing protection or it is not. There is no secure configuration in which the firewall is disabled on any active network profile. Therefore, the baseline requirement of 'On' is also the strictest and only acceptable recommendation.

## Recommended State Configuration

| Security Level | Value |
|----------------|-------|
| **Basic** | `['On']` |
| **Moderate** | `['On']` |
| **Strict** | `['On']` |
| **Type** | `ENUM` |

## Audit Script Working

PowerShell script that retrieves the firewall state for the 'Private' profile. The script must only return the current state ('True' for On, 'False' for Off) and nothing else.

## Remediation Script Working

PowerShell script that accepts a single positional command-line argument to set the firewall state for the 'Private' profile. The argument should be a boolean value ('$true' for On, '$false' for Off). The script must apply the setting and return '$true' on success or '$false' on failure.

