Managing the Windows Firewall via the Command Prompt

While netsh is the classic way to do this, it’s worth noting that Microsoft is slowly nudging everyone toward PowerShell. However, for a quick cmd fix, netsh still works perfectly.

To toggle the firewall for the Global Profile (which affects all profiles: Domain, Private, and Public), use the following commands.

1. Open Command Prompt as Administrator

Before running these, you must right-click Command Prompt and select Run as Administrator. If you don’t, you’ll get an “Access is denied” error.


2. The Commands

ActionCommand
Switch OFFnetsh advfirewall set allprofiles state off
Switch ONnetsh advfirewall set allprofiles state on
Check Statusnetsh advfirewall show allprofiles state

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *