Command Line Manipulation of Windows XP SP2 Firewall

WiFi and the Windows XP firewall have introduced some rather perplexing scenarios.
I have recently found myself in the position of having to dictate how and when the Windows Firewall should be used.

I support a number of WiFi enabled laptops with a slew of apps installed on them.
Some of our users utilize wifi alot.
They network their laptops via broadband routers or by plugging in to many other open networks.

After much thought and cleaning up virii in safe mode.
It became evident to me that I needed to configure the XP Firewall based on the user's connection scenario.
I needed to ensure that they would be operable while working and playing and yet also be protected from hackers while they were posing at WiFi hotspots.
A simple script was written that basically asks "Choose your connection scenario.".
Based on the answer given the script executes various "netsh" commands that perform a number of configuration tasks. Below is a summary of "NETSH" commands that I have found useful on Windows XP SP2.

Add Ports to the Exception List:
netsh firewall add portopening TCP 1234 MyFreakinTCPPort
netsh firewall add portopening UDP 5678 MyFreakinUDPPort

Disable the Firewall:
netsh firewall set opmode disable

Enable the Firewall:
netsh firewall set opmode enable

Enable the Firewall and DO NOT Allow Port \ Program Exceptions:
netsh firewall set opmode enable disable

Enable Firewall and Allow Port \ Program Exceptions:
netsh firewall set opmode enable enable

Enable Firewall on Local Area Connection:
netsh firewall set opmode mode=ENABLE interface="local area connection"

Disable Firewall on Local Area Connection:
netsh firewall set opmode mode=DISABLE interface="local area connection"

Enable the Firewall on Wireless Network Connection:
netsh firewall set opmode mode=ENABLE interface="wireless network connection"

Disable Firewall on Wireless Network Connection:
netsh firewall set opmode mode=DISABLE interface="wireless network connection"


Disclaimer: mikedopp.com is firmly opposed to illegal modification of Software and any illegal activity or breaking copyrights.
We post this because this is educational information and not to be used otherwise,
not because we intend to spread piracy and or promote illegal usage of any software or hardware in any circumstance.