Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Add www.site.com to windows firewall with a click?

Not sure exactly what you're trying to do, but there's always netsh:

Code:
netsh advfirewall firewall add rule name="Allow site.com" dir=out action=allow remoteip=%@ipaddress[www.site.com]
 
I basically do not want any contact with www.site.com and don't want to mess directly/manually with WF - hence just want to do it as a script or at the command line...
 
Here's a cheap and easy approach:

Code:
C:\>ping www.site.com

Pinging www.site.com [204.74.99.100] with 64 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 204.74.99.100:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss)

C:\>echo 127.0.0.1     www.site.com >>! "%systemroot\system32\drivers\etc\hosts"

C:\>nbtstat -R
    Successful purge and preload of the NBT Remote Cache Name Table.

C:\>ping www.site.com

Pinging www.site.com [127.0.0.1] with 64 bytes of data:

Reply from 127.0.0.1: bytes=64 time<1ms TTL=128
Reply from 127.0.0.1: bytes=64 time<1ms TTL=128
Reply from 127.0.0.1: bytes=64 time<1ms TTL=128
Reply from 127.0.0.1: bytes=64 time<1ms TTL=128

Ping statistics for 127.0.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss)
Approximate round trip times in milliseconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\>

I'm pretty sure you need to be running as admin to do this.
 
@Charles Dye :
Good thought but I'd like to maybe have a script I cqan just import into WF to do it, and not have to mess with the hosts file.
 
Back
Top