Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is a simple way in Windows to test if traffic gets through to a specific port on a remote machine?

share|improve this question
Related:… – Pacerier Feb 23 '15 at 11:00
up vote 45 down vote accepted

I found a hiddem gem the other day from Microsoft that is designed for testing ports:


"Portqry.exe is a command-line utility that you can use to help troubleshoot TCP/IP connectivity issues. Portqry.exe runs on Windows 2000-based computers, on Windows XP-based computers, and on Windows Server 2003-based computers. The utility reports the port status of TCP and UDP ports on a computer that you select. "

share|improve this answer

Use the telnet command to connect to the server on the specified port, and see if a connection can be established.


$ telnet my_server 25
220 my_server ESMTP Postfix


$ telnet my_server 23632
Connecting To my_server...Could not open connection to the host, on port 23632:
Connect failed
share|improve this answer
doesn't work for UDP. – Adriano Varoli Piazza Jul 2 '09 at 20:23
UDP is connectionless.. – Amalgovinus Jun 23 '14 at 18:46

Which version of Windows? For Windows 8/Server 2012 and later, the following works in PowerShell:

Test-NetConnection -Port 80

Some Googling will also turn up alternatives which use the .NET Framework directly (since PowerShell lets you do that) for systems running lower versions of Windows that won't have Test-NetConnection available.

If you're not averse to using third-party utilities, Nmap is a very good friend to have.

share|improve this answer
.Net method: $connection = (New-Object Net.Sockets.TcpClient).Connect($target,$port); If ($connection.Connected) { $connection.Close() } – ST8Z6FR57ABE6A8RE9UF Dec 9 '14 at 23:09
On Win7, that doesn't work :-( – samsmith Nov 5 '15 at 0:20
@samsmith Are you talking about the command in my answer, or the one ST8Z...'s comment? The one in my answer only works for Win8/2k12 and higher, and the answer says as much. – Iszi Nov 5 '15 at 14:38
Seems to be Windows 8.1 - Can't seem to find it on Windows 8 – Andy Krouwel Dec 7 '15 at 10:16

Telnet will work for TCP.

Netcat is a better tool for these sorts of things, including UDP, watch out though, some AV softwares consider it an 'evil hacker tool'

share|improve this answer

the following command will list all ports in use on the machine...

netstat -a

The output contains the protocol, local address, foreign address and current state

Netstat documentation on

share|improve this answer
Question asks about open ports on a remote machine, not local. – Chris S Jun 26 '13 at 13:04

'netstat' is you friend.

share|improve this answer
Local machine yes, remote machine no. – Joe Jul 2 '09 at 18:04
This answer was posted before the edit that specified that it's about a port on remote machine. – quosoo Jul 2 '09 at 18:11

protected by Chris S Jun 26 '13 at 13:07

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.