Friday 23 November 2012

Add Windows firewall rules via command line

What:

Windows 7

Problem:

VNC 5900 port is closed, can't connect to remote computer via vnc


Solution:


Gain access to remote pc via console:
psexec.exe \\192.168.1.10 -u "domain\administrator" -p "password" cmd
Run following command:
netsh advfirewall firewall add rule name="UltraVNC" protocol=TCP localport=5900 action=allow dir=IN

Add new rule for wmi:
netsh advfirewall firewall set rule group="windows management instrumentation (wmi)" new enable=yes
Export all rules to text file :
netsh advfirewall firewall show rule name=all > c:\firewall.txt

No comments:

Post a Comment