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:\MyApp\MyApp.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的更多相关文章

  1. [Windows Azure] Adding Sign-On to Your Web Application Using Windows Azure AD

    Adding Sign-On to Your Web Application Using Windows Azure AD 14 out of 19 rated this helpful - Rate ...

  2. win7防火墙打不开(无法启动windows firewall服务)

    点击windows 7控制面板中防火墙的“推荐配置”没有反应:打开“服务”,无法启动windows firewall,并报错.  可能很多的win7用户都碰到过这样的一种情况,那就是win7的防火墙打 ...

  3. How to Programmatically Add/Delete Custom Options in Magento? - See more at: http://apptha.com/blog/

    In this tutorial, I would like to help out Magento developers and clients with how to programmatical ...

  4. windows defender和windows firewall

    Windows defender: Windows Defender,曾用名Microsoft Anti Spyware,是一个杀毒程序,可以运行在Windows XP和Windows Server ...

  5. 关掉Windows Firewall的PowerShell

    在Windows 8或Windows 2012 R2上, 使用下面的命令: Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled ...

  6. SQL Server: Windows Firewall with Advanced Security

    SQL Database Engine: TCP 1433 & UDP 1434 SQL Analysis Service: TCP 2383 (2382 if named instance) ...

  7. Turn Off Windows Firewall Using PowerShell and CMD

    If you want to turn off the Windows Firewall, there are three methods. One is using the GUI which is ...

  8. [Windows] [Firewall] 增加进入规则

    netsh advfirewall firewall add rule name="Open Port 80" dir=in action=allow protocol=TCP l ...

  9. No such application config! Please add dubbo:application

    SpringBoot运行找不到application.properties配置文件 运行springBoot项目启动报错:java.lang.IllegalStateException: No suc ...

随机推荐

  1. 【Java】InnerClass 内部类

    Java 允许一个类的定义位于另一个类的内部,前者为内部类,后者称为外部类 InnerClass一般定义它的类或语句块之中外部类引用时必须给出完整的名称 成员内部类 & 局部内部类 - 静态成 ...

  2. 【Java】【常用类】Object 基类 源码学习

    源码总览: 有好些都是native本地方法,背后是C++写的 没有关于构造器的描述,默认编译器提供的无参构造 https://blog.csdn.net/dmw412724/article/detai ...

  3. getline()和get()的使用区别

    一.getline和get()的使用区别: 首先这两个函数都读取下一行输入,直到到达换行符:但是getline()函数会丢弃换行符,而get()将换行符保留在输入序列中 二.getline()函数的使 ...

  4. c++ find 函数与count函数

    1 algorithml中的find,还有就是string中的find 对对于第一种其调用形式为 find(start,end,value) start搜寻的起点,end搜寻的终点,要寻找的value ...

  5. win10下cuda安装以及利用anaconda安装pytorch-gpu过程

    安装环境:win10+2070super 1.Cuda的下载安装及配置 (1)测试本机独立显卡是否支持CUDA的安装,点击此处查询显卡是否在列表中. (2)查看自己是否能右键找到NVIDA控制面板,如 ...

  6. PHP代码审计理解(二)----齐博CMS7.0文件覆盖

    0x00 前言 因为我是跟着视频操作的,这回真的没理解为什么定位到了这个存在漏洞的文件... /do/fujsarticle.php 因为没有前文,所以这里无法分析这个$FileName为什么可以$_ ...

  7. PHP代码审计理解(一)----Metinfo5.0变量覆盖

    0x01 漏洞简介 这个漏洞是metinfo5.0变量覆盖漏洞,并且需要结合文件包含.我使用的cms版本是5.3,事实上已经修复了这个漏洞(5.0的cms源码已经找不到了哈),但是我们可以借他来学习理 ...

  8. Scrapy爬虫框架(2)--内置py文件

    Scrapy概念图 这里有很多py文件,分别与Scrapy的各个模块对应 superspider是一个爬虫项目 spider1.py则是一个创建好的爬虫文件,爬取资源返回url和数据 items.py ...

  9. PHP 新特性:如何善用接口与Trait

    首先! 接口也可以继承,通过使用 extends 操作符. 案例: <?php interface a { public function foo(); } interface b extend ...

  10. numpy库的学习笔记

    一.ndarray 1.numpy 库处理的最基础数据类型是由同种元素构成的多维数组(ndarray),简称“数组”. 2.ndarray是一个多维数组的对象,ndarray数组一般要求所有元素类型相 ...