Error if .firewall was null for file in BlockHost()

This commit is contained in:
Yorick Barbanneau 2018-04-04 22:43:35 +02:00
parent 915ba84aa1
commit 335ba9b548

View file

@ -26,6 +26,9 @@ function BlockHost {
[object]$params
)
if ( $params.ContainsKey('file') ) {
if ( -not $params.ContainsKey('firewall') -or $params.firewall -eq "" ) {
$params.firewall = $false
}
Get-Content $params.file | where { $_ -notmatch "^#.*$|^$" } | Foreach{ BlockHost -params @{host=$_;firewall=$params.firewall} }
}
elseif ( $params.ContainsKey('host') -and $params.host -ne "" ) {