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.
01Command
$ Set-NetFirewallProfile -All -DefaultInboundAction Block -DefaultOutboundAction Block02What 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
04Undo
$ Set-NetFirewallProfile -All -DefaultInboundAction Allow -DefaultOutboundAction Allow05Sources
- NetSecurity module referenceEvidence: Module reference lists Set-NetFirewallProfile among the Windows Firewall configuration cmdlets.
- Set-NetFirewallProfile (NetSecurity)Evidence: Documents -All, -DefaultInboundAction and -DefaultOutboundAction parameters with Allow/Block values for firewall profiles.
Last verified: 2026-09-19 · Category: Security & Privacy
06Related solutions
Read the Authenticode signature status and signer of any executable or script in PowerShell.
Understand PowerShell's execution policy scopes and set the one that lets you run your own local scripts without gutting the security model.
Search inside text files and logs with regex, returning file, line number and match.