Вывод информации о настройках брандмауэра

$fwCfg = netsh firewall show config
$enable=$disable=$null

switch -regex ($fwCfg)
 {
  "enable" 
    { 
	 $enable+=$switch.current+"`n"
	}
  "disable" 
    { 
	 $disable+=$switch.current+"`n"
	}
 }

Write-Host -ForegroundColor cyan `
  "Firewall configuration on $env:computername"
Write-Host -ForegroundColor green `
  "The following are enabled`n"
  $enable
Write-Host -ForegroundColor red `
  "The following are disabled`n"
  $disable
0
Голосов пока нет

Оставить комментарий