You can use the following links to interact with the Windows firewall. Include NetFwTypeLib as a reference to your project.
For Window Firewall, you can create a manager with the following code:
Type NetFwMgrType = Type.GetTypeFromProgID("HNetCfg.FwMgr", false);
INetFwMgr manager= (INetFwMgr)Activator.CreateInstance(NetFwMgrType);
from there you can read about various methods for configuring the Windows firewall.
Windows Firewall (Windows XP ... limited support for Vista and 7) http://msdn.microsoft.com/en-us/library/aa366452(v=VS.85).aspx
Windows Firewall with Advanced Security (Windows Vista / 7)
msdn.microsoft.com/en-us/library/aa366459 (v = VS.85) .aspx
Dylan source share