Reworked output fot block_shitty_ip ()

This commit is contained in:
Yorick Barbanneau 2018-02-02 09:57:47 +01:00
parent ea5fe14d11
commit bc841b15dd

View file

@ -42,7 +42,7 @@ function is_host_present {
function block_shitty_ip {
param($ip)
Write-Host -ForegroundColor white -NoNewline "Blacklist IP $ip : "
if ( Get-NetFirewallRule -Name Blacklist_$ip) {
if ( Get-NetFirewallRule -Name Blacklist_$ip -ErrorAction SilentlyContinue) {
Write-Host -ForegroundColor Yellow "Already blacklisted"
return
}
@ -54,6 +54,7 @@ function block_shitty_ip {
Write-Host -Nonewline -ForegroundColor Red " Error "
return
}
Write-Host -ForegroundColor Green " Done"
}
}