howtothings.co.uk

Full Version: [How To] Add program and port exceptions to the Windows Firewall via command line
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
[How To] Add program exceptions to the Windows Firewall via command line

This one is quick and easy, a "trick" I learnt some time back that required refreshing recently. I used to use it to allow VNC acceptions within my LAN.

This works in XP, I know in Windows 7 the commands have changed slightly.

The thing as a whole, really quick two liner.

Code:
netsh firewall add portopening TCP 5900 web
netsh firewall add allowedprogram "C:\Program Files\TightVNC\vnc.exe" TightVNC ENABLE


So we have two seperate parts here.

This adds port 5900 as an exception with the name "web".

Code:
netsh firewall add portopening TCP 5900 web


This adds the file vnc.exe as an exception with the name "TightVNC".

Code:
netsh firewall add allowedprogram "C:\Program Files\TightVNC\vnc.exe" TightVNC ENABLE


I've disguised this as an update file before now - you chuck in a @echo off, and a bit of echo The update installed successfully. pause and it looks plausable. You then use one of many programs that allow remote installations.
What would you use this for mark Big Grin?