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


7 Answers 7


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. "


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 also a very good friend to have and it works from the command line.

  • 2
    .Net method: $connection = (New-Object Net.Sockets.TcpClient).Connect($target,$port); If ($connection.Connected) { $connection.Close() } Dec 9, 2014 at 23:09
  • On Win7, that doesn't work :-( Nov 5, 2015 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, 2015 at 14:38
  • 1
    Seems to be Windows 8.1 - Can't seem to find it on Windows 8 Dec 7, 2015 at 10:16
  • 3
    Works great on Windows 10, and I don't need to install any programs or add any features. Thanks! :) Jan 4, 2018 at 16:52

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
  • 17
    doesn't work for UDP. Jul 2, 2009 at 20:23
  • 9
    UDP is connectionless..
    – Alkanshel
    Jun 23, 2014 at 18:46
  • Yes telnet uses TCP not UDP. Yes UDP is "connectionless" but PING (Datagram Sockets) also. So if the UDP port to test can give feedback... As far I remember "connectionless" in TCP/IP does not mean unidirectional but that connection is "not secure" in terms like you might get double answers-packets or not in the right order.
    – grenix
    Jun 10, 2021 at 7:31

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'


Use netcat Windows port:

>nc -zvv www.google.com 80
www.google.com [] 80 (http) open
sent 0, rcvd 0

>nc -zvv www.google.com 888
www.google.com [] 888 (?): TIMEDOUT
sent 0, rcvd 0: NOTSOCK

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 microsoft.com

  • 16
    Question asks about open ports on a remote machine, not local.
    – Chris S
    Jun 26, 2013 at 13:04

'netstat' is you friend.

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

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