howtothings.co.uk
[How To] Add program and port exceptions to the Windows Firewall via command line - Printable Version

+- howtothings.co.uk (https://www.howtothings.co.uk)
+-- Forum: Computing (https://www.howtothings.co.uk/forumdisplay.php?fid=4)
+--- Forum: Operating System and Software Support (https://www.howtothings.co.uk/forumdisplay.php?fid=17)
+--- Thread: [How To] Add program and port exceptions to the Windows Firewall via command line (/showthread.php?tid=965)



[How To] Add program and port exceptions to the Windows Firewall via command line - Mark - 24-08-2011

[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.



RE: [How To] Add program and port exceptions to the Windows Firewall via command line - Drumm - 24-08-2011

What would you use this for mark Big Grin?