1
0 Comments

I am having some trouble understanding the status of the Windows Firewall on Windows 10 and Server 2016 devices. I am trying to gather the following information:

  • Is the Windows Firewall enabled? [NOT WORKING]
  • Are all 3 profiles enabled? [WORKING]
  • Is there a third party Firewall enabled? [WORKING]

From the information displayed, it appears that everything is enabled and functioning properly.

However, when I go up one level, I see a message that suggests the firewall is not enabled

(clicking “Turn on” has no effect).

Upon checking the registry keys located at “HKLM:\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy”, I can see that all three profiles are enabled, but the Windows Firewall itself is disabled.

The script provided detects the presence of third-party firewalls on the device.

$firewalls= @(Get-WmiObject -Namespace $securityCenterNS -class FirewallProduct -ErrorAction Stop)

if($firewalls.Count -eq 0){

    Write-Output "No third party firewall installed."

}else{ 

    $firewalls | Foreach-Object {                       
        [int]$productState=$_.ProductState
        $hexString=[System.Convert]::toString($productState,16).padleft(6,'0')
        $provider=$hexString.substring(0,2)
        $realTimeProtec=$hexString.substring(2,2)
        $definition=$hexString.substring(4,2)

        "Product Name : {0}."     -f $_.displayName
        "Service Type : {0}."     -f $SecurityProvider[[String]$provider]
        "State        : {0}.`n`n" -f $RealTimeBehavior[[String]$realTimeProtec]
    }
}

<# OUTPUT:
Product Name : Bitdefender Firewall
Service Type : AntiVirus
State        : ON
#>

I would like to know how to determine if the Windows Firewall is truly enabled or disabled. Is there a specific value I should be looking for in the registry? Is there a command that I can run to quickly determine the status of the firewall?

Askify Moderator Edited question May 4, 2023