{"id":548,"date":"2025-09-17T06:21:14","date_gmt":"2025-09-17T06:21:14","guid":{"rendered":"https:\/\/faq.powervps.ru\/?p=548"},"modified":"2026-10-01T11:44:08","modified_gmt":"2026-10-01T11:44:08","slug":"%d0%ba%d0%b0%d0%ba-%d0%be%d1%82%d0%ba%d1%80%d1%8b%d1%82%d1%8c-%d0%b1%d1%80%d0%b0%d0%bd%d0%b4%d0%bc%d0%b0%d1%83%d1%8d%d1%80-%d0%b8-%d1%81%d0%be%d0%b7%d0%b4%d0%b0%d1%82%d1%8c-%d0%bf%d1%80%d0%b0%d0%b2","status":"publish","type":"post","link":"https:\/\/faq.powervps.xyz\/?p=548","title":{"rendered":"Windows Server 2019: How to Allow an Application Through Windows Firewall"},"content":{"rendered":"<h1 style=\"text-align: center;\">Windows Server 2019: How to Allow an Application Through Windows Firewall<\/h1>\n<p>This guide explains how to allow an application through Windows Firewall on <strong>Windows Server 2019<\/strong>.<\/p>\n<p>You can create firewall rules using either the graphical interface (<code>wf.msc<\/code>) or PowerShell.<\/p>\n<p><strong>Important:<\/strong> Administrator privileges are required.<\/p>\n<h2 id=\"toc\">Contents<\/h2>\n<ol>\n<li><a href=\"#prereq\">Before You Begin<\/a><\/li>\n<li><a href=\"#gui\">Method 1 \u2014 Using Windows Firewall GUI<\/a><\/li>\n<li><a href=\"#ps\">Method 2 \u2014 Using PowerShell<\/a><\/li>\n<li><a href=\"#ports\">Create a Firewall Rule for a Port<\/a><\/li>\n<li><a href=\"#verify\">Verify the Firewall Configuration<\/a><\/li>\n<li><a href=\"#defender\">Windows Defender Exclusions<\/a><\/li>\n<li><a href=\"#troubleshoot\">Troubleshooting<\/a><\/li>\n<\/ol>\n<h2 id=\"prereq\">1. Before You Begin<\/h2>\n<p>Before creating firewall rules:<\/p>\n<ul>\n<li>Make sure you are logged in with an account that has <strong>Administrator<\/strong> privileges.<\/li>\n<li>Find the full path to the application&#8217;s executable file.<\/li>\n<\/ul>\n<p>For example:<\/p>\n<p><code>C:\\Program Files\\MyApp\\myapp.exe<\/code><\/p>\n<p>If the server is joined to a Windows domain, Group Policy may control the firewall configuration and override local settings.<\/p>\n<h2 id=\"gui\">2. Method 1 \u2014 Using Windows Firewall GUI<\/h2>\n<h3>Step 1. Open Windows Defender Firewall with Advanced Security<\/h3>\n<p>Press:<\/p>\n<p><strong>Win + R<\/strong><\/p>\n<p>Enter:<\/p>\n<p><code>wf.msc<\/code><\/p>\n<p>Press <strong>Enter<\/strong>.<\/p>\n<p>The <strong>Windows Defender Firewall with Advanced Security<\/strong> window will open.<\/p>\n<h3>Step 2. Create a New Inbound Rule<\/h3>\n<p>In the left panel, select:<\/p>\n<p><strong>Inbound Rules<\/strong><\/p>\n<p>Then click:<\/p>\n<p><strong>New Rule&#8230;<\/strong><\/p>\n<h3>Step 3. Select the Rule Type<\/h3>\n<p>Select:<\/p>\n<p><strong>Program<\/strong><\/p>\n<p>Click <strong>Next<\/strong>.<\/p>\n<h3>Step 4. Select the Application<\/h3>\n<p>Select:<\/p>\n<p><strong>This program path<\/strong><\/p>\n<p>Enter the full path to the application&#8217;s executable file.<\/p>\n<p>For example:<\/p>\n<p><code>C:\\Program Files\\MyApp\\myapp.exe<\/code><\/p>\n<p>Click <strong>Next<\/strong>.<\/p>\n<h3>Step 5. Allow the Connection<\/h3>\n<p>Select:<\/p>\n<p><strong>Allow the connection<\/strong><\/p>\n<p>Click <strong>Next<\/strong>.<\/p>\n<h3>Step 6. Select Network Profiles<\/h3>\n<p>Select the profiles where the rule should apply:<\/p>\n<ul>\n<li><strong>Domain<\/strong><\/li>\n<li><strong>Private<\/strong><\/li>\n<li><strong>Public<\/strong><\/li>\n<\/ul>\n<p>Select only the profiles required for your server configuration.<\/p>\n<p>Click <strong>Next<\/strong>.<\/p>\n<h3>Step 7. Name the Rule<\/h3>\n<p>Enter a descriptive name.<\/p>\n<p>For example:<\/p>\n<p><code>Allow MyApp (Inbound)<\/code><\/p>\n<p>Click <strong>Finish<\/strong>.<\/p>\n<p>The application is now allowed to accept incoming connections through Windows Firewall.<\/p>\n<h3>Create an Outbound Rule<\/h3>\n<p>If your firewall configuration also restricts outgoing connections, you can create an outbound rule.<\/p>\n<p>Select:<\/p>\n<p><strong>Outbound Rules \u2192 New Rule&#8230;<\/strong><\/p>\n<p>Then repeat the same steps and select the application&#8217;s executable file.<\/p>\n<h2 id=\"ps\">3. Method 2 \u2014 Using PowerShell<\/h2>\n<p>You can create the same firewall rules using PowerShell.<\/p>\n<p>Open <strong>PowerShell as Administrator<\/strong>.<\/p>\n<p>To allow incoming connections for a specific application:<\/p>\n<pre><code class=\"language-powershell\">New-NetFirewallRule `\r\n    -DisplayName \"Allow MyApp Inbound\" `\r\n    -Direction Inbound `\r\n    -Program \"C:\\Program Files\\MyApp\\myapp.exe\" `\r\n    -Action Allow<\/code><\/pre>\n<p>To allow outgoing connections for the application:<\/p>\n<pre><code class=\"language-powershell\">New-NetFirewallRule `\r\n    -DisplayName \"Allow MyApp Outbound\" `\r\n    -Direction Outbound `\r\n    -Program \"C:\\Program Files\\MyApp\\myapp.exe\" `\r\n    -Action Allow<\/code><\/pre>\n<p>Replace:<\/p>\n<p><code>C:\\Program Files\\MyApp\\myapp.exe<\/code><\/p>\n<p>with the actual path to your application.<\/p>\n<h3>Limit the Rule to Specific Network Profiles<\/h3>\n<p>You can use the <code>-Profile<\/code> parameter.<\/p>\n<p>For example:<\/p>\n<pre><code class=\"language-powershell\">New-NetFirewallRule `\r\n    -DisplayName \"Allow MyApp Inbound\" `\r\n    -Direction Inbound `\r\n    -Program \"C:\\Program Files\\MyApp\\myapp.exe\" `\r\n    -Profile Domain,Private `\r\n    -Action Allow<\/code><\/pre>\n<h2 id=\"ports\">4. Create a Firewall Rule for a Port<\/h2>\n<p>If the application listens on a specific port, you can create a firewall rule for that port instead of the executable file.<\/p>\n<p>For example, to allow incoming TCP connections on port <strong>8080<\/strong>:<\/p>\n<pre><code class=\"language-powershell\">New-NetFirewallRule `\r\n    -DisplayName \"Allow TCP 8080 (Inbound)\" `\r\n    -Direction Inbound `\r\n    -Protocol TCP `\r\n    -LocalPort 8080 `\r\n    -Action Allow<\/code><\/pre>\n<p>Replace <code>8080<\/code> with the port required by your application.<\/p>\n<p>For UDP, use:<\/p>\n<p><code>-Protocol UDP<\/code><\/p>\n<p>For example:<\/p>\n<pre><code class=\"language-powershell\">New-NetFirewallRule `\r\n    -DisplayName \"Allow UDP 8080 (Inbound)\" `\r\n    -Direction Inbound `\r\n    -Protocol UDP `\r\n    -LocalPort 8080 `\r\n    -Action Allow<\/code><\/pre>\n<h2 id=\"verify\">5. Verify the Firewall Configuration<\/h2>\n<h3>Check the Firewall Rule<\/h3>\n<p>To find rules containing the application name:<\/p>\n<pre><code class=\"language-powershell\">Get-NetFirewallRule | Where-Object DisplayName -like \"*MyApp*\"<\/code><\/pre>\n<h3>Check Whether the Application Is Listening on the Port<\/h3>\n<p>For example, to check TCP port <strong>8080<\/strong>:<\/p>\n<pre><code>netstat -ano | findstr :8080<\/code><\/pre>\n<p>You can also use PowerShell:<\/p>\n<pre><code class=\"language-powershell\">Get-NetTCPConnection -LocalPort 8080<\/code><\/pre>\n<h3>Test the Port from Another Computer<\/h3>\n<p>From another Windows machine, run:<\/p>\n<pre><code class=\"language-powershell\">Test-NetConnection -ComputerName &lt;server-ip-or-name&gt; -Port 8080<\/code><\/pre>\n<p>Replace:<\/p>\n<p><code>&lt;server-ip-or-name&gt;<\/code><\/p>\n<p>with the IP address or hostname of your server.<\/p>\n<p>If the connection is successful, you should see:<\/p>\n<p><code>TcpTestSucceeded : True<\/code><\/p>\n<h2 id=\"defender\">6. Windows Defender Exclusions<\/h2>\n<p>Windows Firewall and Microsoft Defender Antivirus are separate components.<\/p>\n<p>If the firewall rule is configured correctly but Microsoft Defender Antivirus is blocking your application, you can add an exclusion.<\/p>\n<p><strong>Important:<\/strong> Add exclusions only for applications you trust. Antivirus exclusions reduce security for the selected files or folders.<\/p>\n<h3>Add a Folder Exclusion<\/h3>\n<pre><code class=\"language-powershell\">Add-MpPreference -ExclusionPath \"C:\\Program Files\\MyApp\"<\/code><\/pre>\n<h3>Add a Process Exclusion<\/h3>\n<pre><code class=\"language-powershell\">Add-MpPreference -ExclusionProcess \"C:\\Program Files\\MyApp\\myapp.exe\"<\/code><\/pre>\n<h3>Check Current Exclusions<\/h3>\n<pre><code class=\"language-powershell\">Get-MpPreference | Select-Object -ExpandProperty ExclusionPath\r\n\r\nGet-MpPreference | Select-Object -ExpandProperty ExclusionProcess<\/code><\/pre>\n<p>If another antivirus product is installed, Microsoft Defender commands may not apply to your configuration.<\/p>\n<h2 id=\"troubleshoot\">7. Troubleshooting<\/h2>\n<h3>The Rule Cannot Be Created<\/h3>\n<p>Make sure <strong>PowerShell<\/strong> or <code>wf.msc<\/code> is running with Administrator privileges.<\/p>\n<h3>Firewall Rules Disappear or Are Replaced<\/h3>\n<p>If the server belongs to a Windows domain, firewall settings may be controlled through Group Policy.<\/p>\n<p>In this case, local firewall rules may be overridden by domain policies.<\/p>\n<h3>The Port Is Open but the Connection Still Fails<\/h3>\n<p>Make sure the application is actually listening on the expected port.<\/p>\n<p>Check with:<\/p>\n<pre><code>netstat -ano | findstr :8080<\/code><\/pre>\n<p>or:<\/p>\n<pre><code class=\"language-powershell\">Get-NetTCPConnection -LocalPort 8080<\/code><\/pre>\n<p>Also check whether traffic is being blocked by:<\/p>\n<ul>\n<li>An external firewall<\/li>\n<li>A provider-side firewall<\/li>\n<li>A network ACL<\/li>\n<li>NAT configuration<\/li>\n<li>A router or gateway<\/li>\n<li>A load balancer<\/li>\n<\/ul>\n<h3>Allow Access Only from Specific IP Addresses<\/h3>\n<p>For better security, you can restrict a firewall rule to trusted remote IP addresses.<\/p>\n<p>For example:<\/p>\n<pre><code class=\"language-powershell\">New-NetFirewallRule `\r\n    -DisplayName \"Allow MyApp from Trusted IP\" `\r\n    -Direction Inbound `\r\n    -Program \"C:\\Program Files\\MyApp\\myapp.exe\" `\r\n    -RemoteAddress \"203.0.113.10\" `\r\n    -Action Allow<\/code><\/pre>\n<p>You can also specify a subnet:<\/p>\n<pre><code>-RemoteAddress \"203.0.113.0\/24\"<\/code><\/pre>\n<h3>Remove a Firewall Rule<\/h3>\n<p>To remove a rule by its display name:<\/p>\n<pre><code class=\"language-powershell\">Remove-NetFirewallRule -DisplayName \"Allow MyApp Inbound\"<\/code><\/pre>\n<h2>Conclusion<\/h2>\n<p>For most applications, you only need to create an <strong>Inbound Rule<\/strong> for the program or the port it listens on.<\/p>\n<p>If your server uses restrictive outbound firewall policies, you may also need an <strong>Outbound Rule<\/strong>.<\/p>\n<p>For better security, avoid opening unnecessary ports to the entire Internet and restrict access to trusted IP addresses whenever possible.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Windows Server 2019: How to Allow an Application Through Windows Firewall This guide explains how to allow an application through Windows Firewall on Windows Server 2019. You can create firewall rules using either the graphical interface (wf.msc) or PowerShell. Important: Administrator privileges are required. Contents Before You Begin Method 1 \u2014 Using Windows Firewall GUI [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-548","post","type-post","status-publish","format-standard","hentry","category-dedicated-servers"],"_links":{"self":[{"href":"https:\/\/faq.powervps.xyz\/index.php?rest_route=\/wp\/v2\/posts\/548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/faq.powervps.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/faq.powervps.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/faq.powervps.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/faq.powervps.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=548"}],"version-history":[{"count":2,"href":"https:\/\/faq.powervps.xyz\/index.php?rest_route=\/wp\/v2\/posts\/548\/revisions"}],"predecessor-version":[{"id":741,"href":"https:\/\/faq.powervps.xyz\/index.php?rest_route=\/wp\/v2\/posts\/548\/revisions\/741"}],"wp:attachment":[{"href":"https:\/\/faq.powervps.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/faq.powervps.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/faq.powervps.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}