• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[How To] Add program and port exceptions to the Windows Firewall via command line
#1
[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.
  Reply
#2
What would you use this for mark Big Grin?
[Image: nomnomnom.jpg]
;7$=v?%v%#5>v7v8994
The decrypt code is V, I could not make it any simpler!
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Add a program to run automatically at startup in Windows 10 Mark 0 1,174 01-09-2022, 02:21 PM
Last Post: Mark
  How to use whois from Windows command line Mark 0 6,640 10-01-2015, 06:17 PM
Last Post: Mark
  Renaming and Deleting printers from the command line Mark 0 7,447 15-05-2012, 01:03 AM
Last Post: Mark
  File ntkrnlpa.exe is open or in use by another program Mark 1 9,659 04-05-2012, 12:51 AM
Last Post: Pack3t SynAck3r
  [TuT]Chat with command promt[TuT] xghost 3 9,320 29-11-2011, 03:59 AM
Last Post: WARLORDTF

Forum Jump: