CBC Computer Services

PowerShell Script to Reset Windows Firewall to Default Settings.

Here’s a PowerShell script that resets the Windows Firewall to its default settings:

# Reset Windows Firewall to default settings
Write-Host "Resetting Windows Firewall to default settings..."

# Reset the firewall rules for all profiles (Domain, Private, Public)
netsh advfirewall reset

# Confirm the reset action
if ($? -eq $true) {
    Write-Host "Windows Firewall has been reset to default settings."
} else {
    Write-Host "Failed to reset Windows Firewall."
}

# Check the current status of the firewall after reset
Write-Host "Checking Windows Firewall status..."
netsh advfirewall show allprofiles

Steps to run the script:

  1. Open PowerShell as an administrator.
  2. Copy and paste the script into PowerShell.
  3. Run the script, and it will reset your Windows Firewall rules to the default configuration.

Let me know if you’d like to adjust or add any specific configurations!