Report $True or $False based on a collection of results

Hello all,

I am trying to create a verification that reports $True is all of the Firewall Profiles are disabled or $False if any of they show as enabled.

Basically I run:

          $DisableFWProfiles = $Null
          $DisableFWProfiles = Get-NetFirewallProfile -Profile * | select-object name,enabled 

This will give me a result as such:

name Enabled


Domain False
Private True
Public False

What I am looking for is:
if all profiles return “Enabled = False” then to return $True
if any of the profiles return “Enabled = True” then to return $False

I tried this but it give me three $True/$False returns

          $DisableFWProfiles = $Null
          $DisableFWProfiles = Get-NetFirewallProfile -Profile * | select-object name,enabled 

          Foreach ($FWProfile in $DisableFWProfiles) {

            If ($FWProfile.Enabled -like "false") {$True}
			Else {$false}
        }

All help is greatly appreciated.

If I’ve understood your question correctly this should give you what you want

$AllFWdisabled = $true

Get-NetFirewallProfile |
foreach {
if ($psitem.Enabled -eq ‘True’) {$AllFWdisabled = $false}
}
$AllFWdisabled

That did the trick.

Thank you very much.