Programmatically add an application to Windows Firewall

Posted Chuck Lu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Programmatically add an application to Windows Firewall相关的知识,希望对你有一定的参考价值。

Programmatically add an application to Windows Firewall

回答1

 

Not sure if this is the best way, but running netsh should work:

netsh firewall add allowedprogram C:MyAppMyApp.exe MyApp ENABLE

I think this requires Administrator Permissions though,for obvious reasons :)

Edit: I just don‘t know enough about ClickOnce to know whether or not you can run external programs through it.

 

 

回答2

I found this article, which has a complete wrapper class included for manipulating the windows firewall. Adding an Application to the Exception list on the Windows Firewall

http://web.archive.org/web/20070707110141/http://www.dot.net.nz/Default.aspx?tabid=42&mid=404&ctl=Details&ItemID=8

 

 

 

 

 

 

以上是关于Programmatically add an application to Windows Firewall的主要内容,如果未能解决你的问题,请参考以下文章

Force SDK to create Appointment programmatically in crm 2013 onPremise

[SVG] Add an SVG as a Background Image

iOS项目添加.pch文件 / How to add a .pch file to an iOS project

Add an Editor to a Detail View 将编辑器添加到详细信息视图

Programmatically mount a Microsoft Virtual Hard Drive (VHD)

[HTML5] Add an SVG Image to a Webpage and Get a Reference to the Internal Elements in JavaScript(代码片