How to change Firewall Rules using command line in Windows Seven

How to change Firewall Rules using command line in Windows SevenIn this article we will show you how you can change the Advanced Windows Firewall rules using the command line in Windows Seven. Some of you might have already tried this and might ask, why do it using command line when you can use the GUI. That's true, you can do it using the GUI, however, with command line, you can put this functionality in a batch file and if you are in a corporate environment and need to deploy this to multiple computers at the same time, then a batch file can be pushed to the machines as a startup policy via active directory, making your task much easier than visiting each computer individually. In Windows Seven, the Windows Firewall has evolved a lot as compared to earlier versions of Windows. The new Firewall in Windows Seven has an advance interface and much much granular rules. The manipulation commands are also different in Windows Firewall and have depreciated the old syntax

In our example we will show how you can obtain an information about a firewall rule, disable the rule and re enable the rule using command line interface in Windows Seven. Note that the rule we are going to change is an advanced firewall setting. The firewall rule we are going to change is related to a the IP V6 protocol, often not needed in every environment, so we will change this rule setting from enabled to disabled.

1. If you want, you can browse to the rule using the GUI by clicking on Control Panel then Windows Firewall, click on Advanced Settings this will bring up Windows Firewall with Advanced Security Window

Browse to the Firewall GUI setting in Windows Seven

2. Click on the Inbound Rules Section

Click on the Inbound Rules Section

3. Click on Core Networking Toredo rule, you can see that its currently turned on (indicated by green)

lick on Core Networking Toredo rule, you can see that its currently turned on (indicated by green)

4. Open a command prompt with Administrative Privileges (You can do this by right clicking on the Command Prompt icon and choosing "run as administrator" or by typing "cmd" in the search box and hitting ctrl + shift + enter)

Open an administrative command prompt

5. To show the current state of this Firewall rule give the following command exactly, netsh advfirewall firewall show rule name="Core Networking - Teredo (UDP-In)"

It will provide the following output showing its currently turned on, which profiles is it applying to, the local ports, ip addresses and protocols its using
  
Rule Name:                            Core Networking - Teredo (UDP-In)
----------------------------------------------------------------------
Enabled:                              Yes
Direction:                            In
Profiles:                             Domain,Private,Public
Grouping:                             Core Networking
LocalIP:                              Any
RemoteIP:                             Any
Protocol:                             UDP
LocalPort:                            Teredo
RemotePort:                           Any
Edge traversal:                       No
Action:                               Allow
Ok.

Show status of current firewall rule in windows 7