# encoding: ascii
# api: powershell
# title: Get-FirewallStatus
# description: Returns $true if the Windows Firewall is enabled, $false if it is disabled.
# version: 0.1
# author: rfoust
# license: CC0
# x-poshcode-id: 4450
# x-archived: 2015-06-26T07:16:32
# x-published: 2015-09-09T19:03:00
#
#
# returns true if windows firewall is enabled, false if it is disabled
filter global:get-firewallstatus ([string]$computer = $env:computername)
	{
	if ($_) { $computer = $_ }

	$HKLM = 2147483650

	$reg = get-wmiobject -list -namespace root\default -computer $computer | where-object { $_.name -eq "StdRegProv" }
	$firewallEnabled = $reg.GetDwordValue($HKLM, "System\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile","EnableFirewall")

	[bool]($firewallEnabled.uValue)
	}
