Προσθήκη κανόνα (rule) στο Firewall με netsh και powershell

 Read it here and here

Για να προσθέσετε κανόνα με command 

netsh advfirewall firewall add rule name="TCP Port 6624" dir=in action=allow protocol=TCP localport=6624

Για να διαγράψετε κανόνα με command

netsh advfirewall firewall delete rule name="TCP Port 6624" protocol=TCP localport=6624

Για να προσθέσετε κανόνα με powershell

New-NetFirewallRule -DisplayName 'My port' -Profile 'Private' -Direction Inbound -Action Allow -Protocol TCP -LocalPort 6624

* To  display all open ports, open command prompt (Start -> Run -> Cmd), type netstat and press Enter.
* To list all listening ports, use netstat -an |find /i “listening” command.
* To see what ports your computer actually communicates with, use netstat -an |find /i “established”
* To find specified open port, use find switch. For example, to find if the port 1433 is open or not, do netstat -an |find /i “1433“. 

Comments