Horje
block ip address windows firewall using powershell from text file Code Example
block ip address windows firewall using powershell from text file
@echo off
if "%1"=="list" (
  netsh advfirewall firewall show rule Blockit | findstr RemoteIP
  exit/b
)

:: Deleting existing block on ips
netsh advfirewall firewall delete rule name="Blockit"

:: Block new ips (while reading them from blockit.txt)
for /f %%i in (blockit.txt) do (
  netsh advfirewall firewall add rule name="Blockit" protocol=any dir=in action=block remoteip=%%i
  netsh advfirewall firewall add rule name="Blockit" protocol=any dir=out action=block remoteip=%%i
)

:: call this batch again with list to show the blocked IPs
call %0 list




Shell

Related
pipe list to rm ubuntu Code Example pipe list to rm ubuntu Code Example
vscode command line run Code Example vscode command line run Code Example
upgrad g++ Code Example upgrad g++ Code Example
not fond apache 2 di ubuntu Code Example not fond apache 2 di ubuntu Code Example
get ssh recovery code Code Example get ssh recovery code Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11