分享学习

标题: 命令行操作windows防火墙,建立bat文件管理员方式运行也可 [打印本页]

作者: admin    时间: 2019-3-29 09:18
标题: 命令行操作windows防火墙,建立bat文件管理员方式运行也可
命令行操作windows防火墙,建立bat文件管理员方式运行也可:
原创文章决绝转载
所有指令请使用管理员权限运行。
根据名称查询在防火墙中的状态:
netsh advfirewall firewall show rule name="TestMircoUtil"
打开防火墙:
netsh advfirewall set allprofiles state on
关闭防火墙:
netsh advfirewall set allprofiles state off
重置防火墙:(作用是回复默认设置,清除所有自己加入的规则)
netsh advfirewall reset
阻止外面ping命令:
netsh advfirewall firewall add rule name="All ICMP V4" dir=in action=block protocol=icmpv4
允许外面ping命令:
netsh advfirewall firewall add rule name="All ICMP V4" dir=in action=allow protocol=icmpv4
允许端口:
netsh advfirewall firewall add rule name="Open SQL Server Port 1433" dir=in action=allow protocol=TCP localport=1433
取消刚刚允许的端口:
netsh advfirewall firewall delete rule name="Open SQL Server Port 1433" protocol=tcp localport=1433
应用加入防火墙的白名单:

允许远程管理:
netsh advfirewall firewall set rule group="remote administration" new enable=yes
允许远程桌面连接:
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes
导出防火墙规则,导入防火墙规则:
netsh advfirewall export "C:\temp\WFconfiguration.wfw"       
netsh advfirewall import "C:\temp\WFconfiguration.wfw"


作者: admin    时间: 2019-3-29 09:26
一些英文介绍:
https://support.microsoft.com/en ... nstead-of-the-netsh
作者: admin    时间: 2019-6-11 13:16
使用C++程序添加到防火墙:
https://blog.csdn.net/thanklife/article/details/60866784    使用c++调用命令行方式
https://docs.microsoft.com/en-us/previous-versions//aa364726(v=vs.85)  使用winapi方式

手动关闭windows defender防护
https://blog.csdn.net/qiangzaizaio/article/details/52744959/




欢迎光临 分享学习 (http://1314xuexi.com/) Powered by Discuz! X3.3