To Allow App through Windows Defender Firewall in Command Prompt

Add or Remove Allowed Apps through Windows Firewall in Windows 10

Starting with Windows 10 build 16193, Windows Firewall has been renamed to Windows Defender Firewall.

Windows Firewall can help prevent hackers or malicious software from gaining access to your PC through the Internet or a network.

Sometimes you may need to allow an app through Windows Firewall. When you allow an app to communicate though the firewall, it's called adding an exception or rule.

Usually this will happen automatically. Windows will automatically create exceptions for its own system services and apps. When you install a new app that wants to communicate through the firewall, Windows will prompt you to allow access for it to do so.

You may also want or need to create an exception manually to allow an app to communicate through the firewall.

This tutorial will show you different ways on how to manually remove or add apps to be allowed through Windows Firewall in Windows 10.

You must be signed in as an administrator to remove or add allowed apps through Windows Firewall.

CONTENTS:

    • Option One: To Allow App through Windows Defender Firewall in Windows Security Alert
    • Option Two: To Allow App through Windows Defender Firewall in Windows Firewall Settings
    • Option Three: To Remove Allowed App in Windows Defender Firewall Settings
    • Option Four: To Allow App through Windows Defender Firewall in Command Prompt
    • Option Five: To Remove Allowed App in Command Prompt
    • Option Six: To Allow App through Windows Defender Firewall in PowerShell
    • Option Seven: To Remove Allowed App in PowerShell

To Allow App through Windows Defender Firewall in PowerShell

To see more usage options for the New-NetFirewallRule command, see: New-NetFirewallRule - Microsoft Docs

1. Open an elevated PowerShell.

2. Enter the command below into the elevated PowerShell, and press Enter. (see screenshot below)


(Allow app)
New-NetFirewallRule -DisplayName "app name" -Direction Inbound -Program "Full path of .exe" -Action Allow

OR

(Block app)
New-NetFirewallRule -DisplayName "app name" -Direction Inbound -Program "Full path of .exe" -Action Block

Note   Note
Substitute app name in the command above with the actual name of the app (ex: "Google Chrome").

Substitute Full path of .exe in the command above with the actual full path to the .exe file (ex: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe") of the app.

For example:
Code:
New-NetFirewallRule -DisplayName "Google Chrome" -Direction Inbound -Program "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -Action Allow

 

 

3. When finished, you can close the elevated PowerShell if you like.

 

To Remove Allowed App in PowerShell

To see more usage options for the Remove-NetFirewallRule command, see: Remove-NetFirewallRule - Microsoft Docs

1. Open an elevated PowerShell.

2. Enter the command below into the elevated PowerShell, and press Enter. (see screenshot below)


Show-NetFirewallRule | Out-File "$env:userprofile\Desktop\WindowsFirewallRules.txt"

Add or Remove Allowed Apps through Windows Firewall in Windows 10-show_windows_firewall_rules_powershell.png


3. You will now have a WindowsFirewallRules.txt file saved to your desktop containing a list of all Windows Firewall rules.

4. Open the WindowsFirewallRules.txt file, and make note of the DisplayName (ex: "Google Chrome") of the app you want to remove all rules for. (see screenshot below)

 

 


5. Enter the command below into the elevated PowerShell, and press Enter. (see screenshot below)


Remove-NetFirewallRule -DisplayName "DisplayName"

Note   Note
Substitute DisplayName in the command above with the actual rule name (ex: "Google Chrome") you want to remove from step 4 above.

For example: Remove-NetFirewallRule -DisplayName "Google Chrome"

Add or Remove Allowed Apps through Windows Firewall in Windows 10-delete_windows_firewall_rule_powershell.png


6. When finished, you can close the elevated PowerShell if you like.

 

How to use the "netsh advfirewall firewall" context instead of the "netsh firewall" context to control Windows Firewall behavior in Windows Server 2008 and in Windows Vista

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(429)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2019-05-28 Activator.CreateInstance with parameters
2019-05-28 outlook使用inline style回复邮件
2019-05-28 回复git@vger.kernel.org的注意事项
2019-05-28 Majordomo Info VGER.KERNEL.ORG
2018-05-28 how to modify vs2017
2018-05-28 node inspector的安装以及使用【已经淘汰了】
2018-05-28 npm安装以及命令行
点击右上角即可分享
微信分享提示