# encoding: ascii
# api: powershell
# title: Get-FirewallStatus2
# description: An alternate method of querying the registry to return the firewall status (returns $true or $false). This one does not use WMI.
# version: 0.1
# license: CC0
# x-poshcode-id: 838
# x-archived: 2009-02-04T18:04:42
#
#
filter global:get-firewallstatus2 ([string]$computer = $env:computername)
	{
	if ($_) { $computer = $_ }

	$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("LocalMachine",$computer)

	$firewallEnabled = $reg.OpenSubKey("System\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile").GetValue("EnableFirewall")

	[bool]$firewallEnabled
	}
