Windows Firewall Kill Switch: Block All Traffic at Once

Set both firewall profiles to deny by default so nothing leaves or enters the PC except explicitly allowed rules.

WindowssecuritypowershellfirewallLow risk
Run `Set-NetFirewallProfile -All -DefaultInboundAction Block -DefaultOutboundAction Block` for a total firewall lockdown; restore with the Allow variant.

01Command

Command
$ Set-NetFirewallProfile -All -DefaultInboundAction Block -DefaultOutboundAction Block

02What it does

The default action of each firewall profile decides what happens to traffic that no rule matches. Setting them to Block creates an instant VPN-style kill switch: only the allow rules you have explicitly created keep working. It's a useful panic button on untrusted networks or while investigating a suspected infection.

03Risk

RiskLow risk
RequirementsAdministrator PowerShell; Windows 10/11 built-in firewall.
!Warning: While enabled you'll lose internet, LAN, and printing until you run the undo command — keep it in your clipboard.

04Undo

Undo
$ Set-NetFirewallProfile -All -DefaultInboundAction Allow -DefaultOutboundAction Allow

05Sources

  • NetSecurity module reference
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Module reference lists Set-NetFirewallProfile among the Windows Firewall configuration cmdlets.
  • Set-NetFirewallProfile (NetSecurity)
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Documents -All, -DefaultInboundAction and -DefaultOutboundAction parameters with Allow/Block values for firewall profiles.

Last verified: 2026-09-19 · Category: Security & Privacy

06Related solutions