Test-NetConnection

Test-NetConnection

Displays diagnostic information for a connection.

Sintaxis

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>]

Descripción detallada

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.

Parámetros

-CommonTCPPort<String>

Specifies the common service TCP port number. Los valores aceptables para este parámetro son los siguientes:

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

Alias

ninguno

¿Requerido?

true

¿Posición?

2

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

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.

Alias

RemoteAddress,cn

¿Requerido?

false

¿Posición?

1

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByValue, ByPropertyName)

¿Aceptar caracteres comodín?

false

-Hops<Int32>

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

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-InformationLevel<String>

Specifies the information level. Los valores aceptables para este parámetro son los siguientes:

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

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

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.

Alias

RemotePort

¿Requerido?

true

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-TraceRoute

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

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

<CommonParameters>

Este cmdlet admite los siguientes parámetros comunes: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer y -OutVariable. Para obtener más información, consulte about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Entradas

El tipo de entrada es el tipo de los objetos que se pueden canalizar al cmdlet.

  • none

Salidas

El tipo de resultado es el tipo de objetos que emite el cmdlet.

  • NetConnectionResults

    Results of the connectivity test to the specified computer name

Ejemplos

Example 1: Test a connection

This command tests a network connection.

PS C:\> Test-NetConnection

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

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