Turn Off Windows Firewall from the Command Line using netsh

Hi all

There may be times you will need to turn off Windows Firewall using the command line such as creating a scripted OS install or when working with Windows Server Core. There is a quick and easy way to do this using the netsh command line utility. The utility enables you to turn off the firewall the Domain, Private, or Public Networks individually or all for all networks at once.

To begin, open a command prompt as administrator.

To turn off Windows Firewall for Domain Networks type the following command:

netsh advfirewall set domain state off

To turn off Windows Firewall for Private Networks type the following command:

netsh advfirewall set private state off

To turn off Windows Firewall for Public Networks type the following command:

netsh advfirewall set public state off

To turn off Windows Firewall for All Networks (Domain, Private, Public) type the following command:

netsh advfirewall set allprofiles state off

Now, if you needed to turn Windows Firewall back on using this utility you can type the same commands and just change “off” to “on”. For example, if you wanted to turn the Windows Firewall on for all networks you would type the following command:

netsh advfirewall set allprofiles state on

I hope this helps. As always, if you have any questions or feedback, please leave a comment.

Share Button
Author: BC

BC is a Pipe2text.com contributor and has been an IT Professional for 15 years. He currently works as a Sr. Systems Engineer at a private firm. He enjoys working with Active Directory, Exchange and VMware among other technologies.


Leave a Reply

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