How do I determine if a port is open on a Windows server?


I'm trying to install a site under an alternative port on a server, but the port may be closed by a firewall. Is there a way to ping out or in, on a specific port, to see if it is open?

8/3/2019 4:07:26 PM

Accepted Answer

Assuming that it's a TCP (rather than UDP) port that you're trying to use:

  1. On the server itself, use netstat -an to check to see which ports are listening.

  2. From outside, just use telnet host port (or telnet host:port on Unix systems) to see if the connection is refused, accepted, or timeouts.

On that latter test, then in general:

  • connection refused means that nothing is running on that port
  • accepted means that something is running on that port
  • timeout means that a firewall is blocking access

On Windows 7 or Windows Vista the default option 'telnet' is not recognized as an internal or external command, operable program or batch file. To solve this, just enable it: Click *Start** → Control PanelProgramsTurn Windows Features on or off. In the list, scroll down and select Telnet Client and click OK.

8/3/2019 4:11:13 PM

On Windows you can use

netstat -na | find "your_port"

to narrow down the results. You can also filter for LISTENING, ESTABLISHED, TCP and such. Mind it's case-sensitive though.


If you're checking from the outside, not from the server itself, and you don't want to bother installing telnet (as it doesn't come with the last versions of Windows) or any other software, then you have native PowerShell:

Test-NetConnection -Port 800 -ComputerName -InformationLevel Detailed

(Unfortunately this only works with PowerShell 4.0 or newer. To check your PowerShell version, type $PSVersionTable.)

PS: Note, these days there are some claims on the twittersphere that hint that this answer could be improved by mentioning "Test-Connection" from PowerShell Core, or the shortcut "tnc". See and help me edit this answer to improve it please!

(If you have a PSVersion < 4.0, you're out of luck. Check this table:

Enter image description here

Even though you can upgrade your version of PowerShell by installing the Windows Management Framework 4.0, it didn't do the trick for me, Test-NetConnection cmdlet is still not available).


On a Windows machine you can use PortQry from Microsoft to check whether an application is already listening on a specific port using the following command:

portqry -n -p tcp -e 80

I did like that:

netstat -an | find "8080" 

from telnet

telnet 8080

And just make sure that the firewall is off on that machine.


If telnet is not available, download PuTTY. It is a far superior Telnet, SSH, etc. client and will be useful in many situations, not just this one, especially if you are administering a server.