Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Test-NetConnection

Test-NetConnection

test-netconnection.psm1

Synopsis

Displays diagnostic information for a connection.

Syntax

Test-NetConnection [-ComputerName] [-CommonTCPPort] [-InformationLevel] [<CommonParameters>]

Test-NetConnection [-ComputerName] [-Hops] [-InformationLevel] [-TraceRoute] [<CommonParameters>]

Test-NetConnection [-ComputerName] [-InformationLevel] [-Port] [<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 <SwitchParameter>

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

Input Type

none

Return Type

NetConnectionResults

Notes

None

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

Online Version