• Use PowerShell to test connection to a port

    by  • 2017/06/13 • Tech • 0 Comments

    To quickly test if you can communicate with a server on a specific port use this command:
    Test-NetConnection (hostname/ip) -Port (tcp port number)
    You are looking for TcpTestSucceeded : True in the output.

    PS C:\Users\Clint> Test-NetConnection www.google.com -port 80

    ComputerName : www.google.com
    RemoteAddress :
    RemotePort : 80
    InterfaceAlias : vEthernet (LAN) 2
    SourceAddress :
    TcpTestSucceeded : True

    This command is quite flexible, you can also have it test with ICMP like PING and Trace Route.

    For a simple ping test: Test-NetConnection www.google.com
    For a trace route test: Test-NetConnection www.google.com -TraceRoute

    Does not appear to support UDP test, in PowerShell 5…


    Clint McGuire is a Computer Consultant based out of Vancouver Canada. He specializes in VMware and Storage.

    Leave a Reply

    Your email address will not be published. Required fields are marked *