Enable – Disable Firewall in Windows Server 2012

I can tell that I am not experienced at all with Windows Server Operating System. The last year I had some experience with Windows Server 2003, 2008 and 2012 but that was for some little projects, and I have not in depth knowledge. Today I tried to turn off firewall on windows server 2012. The metro style got me on firewall rules when I typed firewall on search. Then the first thing I though as a linux admin was to stop the service and not keep searching for firewall turn off feature, I saw sometimes here and there.

I stopped the service and Ooops the Remote Desktop Connection was broken. I thought it might needs some time to reinitialize network interfaces. Waiting for a ping response from the server, I googled about that incident and I found a great powershell command to turn off and on the firewall:

netsh advfirewall set allprofiles state off
 netsh advfirewall set allprofiles state on

I posted this command just to remember that there is a simple way to just do it, even in Windows. 🙂


Now it’s time to describe the other way ( the gui one ) for Windows lovers:

Go to Control Panel -> System and Security -> Windows Firewall


Click on the left sidebar the link:

Turn Windows Firewall on or off

and then select for each level to turn it on or off.



The last thing I want to to say, either you are getting dirty hands on linux or windows, do not turn off firewall. You can disable it for a while or for testing purposes, but if you want to stay secure ( as secure as you can ) do not turn it off.

8 Replies to “Enable – Disable Firewall in Windows Server 2012”

    1. To be honest I am not experienced to identify which command is a regular cmd.exe command or powershell or whatever. I would appreciate if you could give a clue how to identify them in windows OS.

    1. by the way, the powershell cmdlet to disable firewall on all profiles (Domain, Public, Private) is:
      Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True
      instead, to disable all profiles, with less typing:
      Set-NetFirewallProfile -Profile * -Enabled False

  1. A simple way to tell if a command is powershell or not is that all powershell commands are verb-noun pairs, cmd.exe commands are (in general) not.

    Commands like, write-host, get-help, format-list are powershell, for example.

Leave a Reply

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

Prove me that you are not a robot :) * Time limit is exhausted. Please reload the CAPTCHA.