How to know currently open ports on the Windows Firewall?

Posted by QIU Quan on Server Fault See other posts from Server Fault or by QIU Quan
Published on 2011-01-11T11:59:46Z Indexed on 2011/01/11 12:55 UTC
Read the original article Hit count: 292

On Windows XP and Windows Server 2003, I can know currently open ports on the Windows Firewall using the following command:

netsh firewall show state

However, on Windows 7 and Hyper-V Server 2008 R2, when I give that command, it says:

No ports are currently open on all network interfaces.

IMPORTANT: Command executed successfully.
However, "netsh firewall" is deprecated;
use "netsh advfirewall firewall" instead.

Apparently there are ports open because services such as NetBIOS NS, Remote Desktop, and Hyper-V remote administration are functioning.

I tried a few 'netsh advfirewall' show commands, but didn't get a way to find out which ports are permit by Windows Firewall.

Knowing the currently open ports, I can be sure that I'm permitting necessary and sufficient traffic to pass in, no more, no less.

Going through the whole set of advanced firewall rules is so tedious and error-prone.

Is there a command on Windows 7 and Windows Server 2008 to do this efficiently?

© Server Fault or respective owner

Related posts about windows-server-2008

Related posts about windows-7