0

I'm banning IPs using the Windows Firewall with these commands in cmd (actually in C# but using the cmd):

pushd advfirewall firewall
set rule name="BlockedIPs" new remoteip="1.2.3.4" action=block protocol=any dir=in
popd

How do I remove a single IP from that rule using cmd again, without deleting the whole rule? Thanks.

1 Answers1

0

I think you could do something like this :

netsh advfirewall firewall delete rule name="BlockedIPs" remoteip="1.2.3.4"

This should delete the rule where remoteip is 1.2.3.4 from the rule named BlockedIPs

krisFR
  • 13,280
  • 4
  • 36
  • 42
  • Thanks, I'll get back to the accept button as soon as I tried it! – Thebananaking May 19 '14 at 00:29
  • Yeah, I guess adding and removing single IPs from an existent rule isn't as easily possible in Windows as I thought. I ended up creating and deleting a new rule for each IP, so this solution worked fine. – Thebananaking May 19 '14 at 09:07