Export (0) Print
Expand All

Test-NetConnection

Windows Server 2012 R2 and Windows 8.1

Updated: October 17, 2013

Applies To: Windows 8.1, Windows PowerShell 4.0, Windows Server 2012 R2

Test-NetConnection

Displays diagnostic information for a connection.

Syntax

Parameter Set: CommonTCPPort
Test-NetConnection [[-ComputerName] <String> ] [-CommonTCPPort] <String> [-InformationLevel <String> ] [ <CommonParameters>]

Parameter Set: ICMP
Test-NetConnection [[-ComputerName] <String> ] [-Hops <Int32> ] [-InformationLevel <String> ] [-TraceRoute] [ <CommonParameters>]

Parameter Set: RemotePort
Test-NetConnection [[-ComputerName] <String> ] -Port <Int32> [-InformationLevel <String> ] [ <CommonParameters>]




Detailed Description

The Test-NetConnection cmdlet displays diagnostic information for a connection. The output includes the results of a DNS lookup, a listing of IP interfaces, an option to test a TCP connection, IPsec rules, and confirmation of connection establishment.

Parameters

-CommonTCPPort<String>

Specifies the common service TCP port number. The acceptable values for this parameter are: 

-- SMB
-- HTTP
-- RDP
-- PING


Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ComputerName<String>

Specifies the Domain Name System (DNS) name or IP address of the target computer that runs the Dynamic Host Configuration Protocol (DHCP) server service.


Aliases

RemoteAddress,cn

Required?

false

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-Hops<Int32>

Specifies the number of hops to traverse in a trace route command.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-InformationLevel<String>

Specifies the information level. The acceptable values for this parameter are: 

-- Detailed
-- Quiet

If you set this parameter to Quiet, the cmdlet returns a Boolean value that indicates if the attempt to ping a host or port succeeded.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Port<Int32>

Specifies the TCP port number on the remote computer. The cmdlet uses this port number to test connectivity to the remote machine.


Aliases

RemotePort

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-TraceRoute

Indicates that Tracert runs to test connectivity to the remote host.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • none

Outputs

The output type is the type of the objects that the cmdlet emits.

  • NetConnectionResults

    Results of the connectivity test to the specified computer name


Examples

Example 1: Test a connection

This command tests a network connection.


PS C:\> Test-NetConnection
ComputerName : gateway.contoso.com 
RemoteAddress : 2620:0:30::197
InterfaceAlias : Ethernet 3
SourceAddress : 2001:4898:1b:1046:cda8:e200:e2cd:1e8b
PingSucceeded : True

Example 2: Test a connection and display detailed results

This command tests a network connection and sets the InformationLevel parameter to Detailed.


PS C:\> Test-NetConnection -Port 80 -InformationLevel Detailed
ComputerName : gateway.contoso.com 
RemoteAddress : 2620:0:30::197
RemotePort : 80
AllNameResolutionResults : 10.253.21.197
10.79.197.197
2620:0:30::197
MatchingIPsecRules : Ipsec-Win8/Domain-TrafficFromInternet-v6
NetworkIsolationContext : Internet
InterfaceAlias : Ethernet 3
SourceAddress : 2001:4898:1b:1046:cda8:e200:e2cd:1e8b
NetRoute (NextHop) : fe80::21a:30ff:feaf:5400
PingSucceeded : True
PingReplyDetails (RTT) : 1 ms
TcpTestSucceeded : True

Example 3: Test a connection to a remote host

This command tests a network connection to a remote host named www.contoso.com.


PS C:\> Test-NetConnection -ComputerName www.contoso.com -InformationLevel Detailed
ComputerName : www.contoso.com 
RemoteAddress : 2600:1409::1703:6929
AllNameResolutionResults : 10.3.105.104
10.3.105.113
10.3.105.114
10.3.105.41
10.3.105.43
2600:1409::1703:6929
2600:1409::1703:692b
2600:1409::1703:6972
InterfaceAlias : Ethernet 3
SourceAddress : 2001:4898:1b:1046:cda8:e200:e2cd:1e8b
NetRoute (NextHop) : fe80::21a:30ff:feaf:5400
PingSucceeded : True
PingReplyDetails (RTT) : 164 ms

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft