Add App to Firewall

Win XP

@echo OFF
netsh firewall add allowedprogram “c:\\program files\\Skype.exe” skype enable >nul
netsh firewall add portopening tcp 139 “File And printer Sharing” >nul
netsh firewall add portopening tcp 445 “File And printer Sharing” >nul
netsh firewall add portopening tcp 137 “File And printer Sharing” >nul
netsh firewall add portopening tcp 138 “File And printer Sharing” >nul
netsh firewall add portopening tcp 5900 vnc5900 >nul
netsh firewall add portopening tcp 5800 vnc5800 >nul
netsh firewall add allowedprogram “C:\\Program Files\\UltraVNC\\winvnc.exe” winvnc.exe >nul
netsh firewall add allowedprogram “C:\\Program Files\\UltraVNC\\vncviewer.exe” vncviewer.exe >nul
Echo Done!
pause

 

Win 7

@echo off
:: This command demonstrates the use of a whitelist.
:: All of the IP addresses we want to grant access to are explicitly listed.

netsh advfirewall firewall set rule name=”TEST – allow incoming” dir=in new name=”TEST – allow incoming” dir=in action=allow program=”C:\This is a test\Test.exe” remoteip=61.0.0.4,72.87.0.5,127.0.0.1-127.0.0.2,127.0.0.4-127.0.0.5

:: This command demonstrates the use of a blacklist.
:: All of the IP addresses we want to grant access to are explicitly not listed.
netsh advfirewall firewall set rule name=”TEST – block outgoing” dir=out new name=”TEST – block outgoing” dir=out action=block program=”C:\This is a test\Test.exe” remoteip=0.0.0.0-61.0.0.3,61.0.0.5-72.87.0.4,72.87.0.6-127.0.0.0,127.0.0.3,127.0.0.6-255.255.255.255

email me