Friday, 23 November 2012

Add Windows firewall rules via command line


Windows 7


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


Gain access to remote pc via console:
psexec.exe \\ -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