Skip to content

windows_firewall_toggle.ps1

Corey Watson edited this page Dec 1, 2025 · 1 revision

windows_firewall_toggle.ps1

Toggle Windows Firewall on/off for all profiles.

Overview

Toggles Windows Firewall state for all profiles (Domain, Private, Public). If firewall is ON, turns it OFF. If firewall is OFF, turns it ON.

Purpose

Provides quick firewall toggle functionality for troubleshooting network connectivity issues on managed endpoints.

Prerequisites

  • Windows 10/11
  • Admin privileges required

Configuration

Required Inputs

None - script automatically detects current state and toggles.

Settings

  • Affects all firewall profiles: Domain, Private, Public
  • Toggle behavior: ON -> OFF, OFF -> ON

Behavior

  1. Queries current firewall state for all profiles
  2. Determines if firewall is currently enabled or disabled
  3. Toggles to opposite state
  4. Verifies new state

Security Notes

  • No secrets in logs
  • WARNING: Disabling firewall reduces system security
  • Use with caution in production environments

Exit Codes

  • 0: Success
  • 1: Failure

Example Output

[ CURRENT STATE ]
--------------------------------------------------------------
Domain Profile  : ON
Private Profile : ON
Public Profile  : ON

[ OPERATION ]
--------------------------------------------------------------
Firewall is currently ON
Turning firewall OFF...

[ NEW STATE ]
--------------------------------------------------------------
Domain Profile  : OFF
Private Profile : OFF
Public Profile  : OFF

[ RESULT ]
--------------------------------------------------------------
Status : Success
Action : Firewall disabled

[ SCRIPT COMPLETED ]
--------------------------------------------------------------

Version History

  • v1.0.0 (2025-11-29): Initial Style A implementation

Links

Clone this wiki locally