Error if .firewall was null for file in BlockHost()
This commit is contained in:
parent
915ba84aa1
commit
335ba9b548
1 changed files with 3 additions and 0 deletions
|
@ -26,6 +26,9 @@ function BlockHost {
|
||||||
[object]$params
|
[object]$params
|
||||||
)
|
)
|
||||||
if ( $params.ContainsKey('file') ) {
|
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} }
|
Get-Content $params.file | where { $_ -notmatch "^#.*$|^$" } | Foreach{ BlockHost -params @{host=$_;firewall=$params.firewall} }
|
||||||
}
|
}
|
||||||
elseif ( $params.ContainsKey('host') -and $params.host -ne "" ) {
|
elseif ( $params.ContainsKey('host') -and $params.host -ne "" ) {
|
||||||
|
|
Reference in a new issue