[GH-ISSUE #587] Windows Firewall Check Script - Public/Private Networks #2317

Closed
opened 2026-03-14 03:33:32 +03:00 by kerem · 3 comments
Owner

Originally created by @zburkhardt on GitHub (Jun 19, 2021).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/587

Originally assigned to: @silversword411 on GitHub.

Server Info (please complete the following information):

  • OS: Ubuntu Server 20.04.2
  • Browser: Chrome
  • RMM Version (as shown in top left of web UI): v0.6.15

Installation Method:

  • Standard
  • Docker

Agent Info (please complete the following information):

  • Agent version (as shown in the 'Summary' tab of the agent from web UI): v1.5.8
  • Agent OS: Windows 10 20H2 or 21H1 (haven't tested further back)

Describe the bug
The "Windows Firewall - Check Status" script will print "Firewall is Enabled" and exit with code 0 any time the Domain firewall profile is still enabled but the Public and/or Private firewall profiles are disabled, regardless of what the current network type is

To Reproduce
Steps to reproduce the behavior:

  1. Make sure the current connection profile is either Public or Private, not Domain.
  2. Disable the Public and/or Private profiles in Windows Firewall, but keep the Domain profile active.
  3. Run the "Windows Firewall - Check Status" script and check the output

Expected behavior
Expected script to exit with code 1 when the current active firewall profile is disabled (or maybe when any firewall profile is disabled?)

Screenshots
image
image

Additional context
If you run "(get-netfirewallprofile -policystore activestore).Enabled" in Powershell, it looks like it lists the active status for all three profiles, in order of:

  • Domain
  • Private
  • Public
    Hence why the script thinks the firewall is still enabled
Originally created by @zburkhardt on GitHub (Jun 19, 2021). Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/587 Originally assigned to: @silversword411 on GitHub. **Server Info (please complete the following information):** - OS: Ubuntu Server 20.04.2 - Browser: Chrome - RMM Version (as shown in top left of web UI): v0.6.15 **Installation Method:** - [X] Standard - [ ] Docker **Agent Info (please complete the following information):** - Agent version (as shown in the 'Summary' tab of the agent from web UI): v1.5.8 - Agent OS: Windows 10 20H2 or 21H1 (haven't tested further back) **Describe the bug** The "Windows Firewall - Check Status" script will print "Firewall is Enabled" and exit with code 0 any time the Domain firewall profile is still enabled but the Public and/or Private firewall profiles are disabled, regardless of what the current network type is **To Reproduce** Steps to reproduce the behavior: 1. Make sure the current connection profile is either Public or Private, not Domain. 2. Disable the Public and/or Private profiles in Windows Firewall, but keep the Domain profile active. 3. Run the "Windows Firewall - Check Status" script and check the output **Expected behavior** Expected script to exit with code 1 when the current active firewall profile is disabled (or maybe when any firewall profile is disabled?) **Screenshots** ![image](https://user-images.githubusercontent.com/43223790/122654722-61333480-d11b-11eb-90b5-bd41f83efcdf.png) ![image](https://user-images.githubusercontent.com/43223790/122654705-46f95680-d11b-11eb-9926-15bf76a46947.png) **Additional context** If you run "(get-netfirewallprofile -policystore activestore).Enabled" in Powershell, it looks like it lists the active status for all three profiles, in order of: - Domain - Private - Public Hence why the script thinks the firewall is still enabled
kerem closed this issue 2026-03-14 03:33:37 +03:00
Author
Owner

@silversword411 commented on GitHub (Jun 19, 2021):

Well, technically the firewall is still enabled.

Let see if I can improve the return info :)

<!-- gh-comment-id:864466324 --> @silversword411 commented on GitHub (Jun 19, 2021): Well, technically the firewall is still enabled. Let see if I can improve the return info :)
Author
Owner

@sdm216 commented on GitHub (Jun 28, 2021):

Just switch the if statement to false, and swap the exit codes.

$ErrorActionPreference = 'silentlycontinue'
$fwenabled = (get-netfirewallprofile -policystore activestore).Enabled

if ($fwenabled.Contains('False')) {
Write-Output "Firewall is Disabled"
exit 1
}

else {
Write-Host "Firewall is Enabled"
exit 0
}

Exit $LASTEXITCODE

<!-- gh-comment-id:869928595 --> @sdm216 commented on GitHub (Jun 28, 2021): Just switch the if statement to false, and swap the exit codes. $ErrorActionPreference = 'silentlycontinue' $fwenabled = (get-netfirewallprofile -policystore activestore).Enabled if ($fwenabled.Contains('False')) { Write-Output "Firewall is Disabled" exit 1 } else { Write-Host "Firewall is Enabled" exit 0 } Exit $LASTEXITCODE
Author
Owner

@dinger1986 commented on GitHub (Jun 28, 2021):

Feel free to submit or change the firewall script with a pull request.

I am sure I wrote that and used whatever ms suggested was the best way to check it.

<!-- gh-comment-id:869930542 --> @dinger1986 commented on GitHub (Jun 28, 2021): Feel free to submit or change the firewall script with a pull request. I am sure I wrote that and used whatever ms suggested was the best way to check it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tacticalrmm#2317
No description provided.