Condividi tramite


Test-NetConnection

Test-NetConnection

Displays diagnostic information for a connection.

Sintassi

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

Descrizione dettagliata

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.

Parametri

-CommonTCPPort<String>

Specifies the common service TCP port number. I valori accettabili per questo parametro sono:

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

Alias

nessuno

Obbligatorio?

true

Posizione?

2

Valore predefinito

nessuno

Accetta input da pipeline?

false

Accetta caratteri jolly?

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

Obbligatorio?

false

Posizione?

1

Valore predefinito

nessuno

Accetta input da pipeline?

True (ByValue, ByPropertyName)

Accetta caratteri jolly?

false

-Hops<Int32>

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

Alias

nessuno

Obbligatorio?

false

Posizione?

named

Valore predefinito

nessuno

Accetta input da pipeline?

false

Accetta caratteri jolly?

false

-InformationLevel<String>

Specifies the information level. I valori accettabili per questo parametro sono:

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

nessuno

Obbligatorio?

false

Posizione?

named

Valore predefinito

nessuno

Accetta input da pipeline?

false

Accetta caratteri jolly?

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

Obbligatorio?

true

Posizione?

named

Valore predefinito

nessuno

Accetta input da pipeline?

True (ByPropertyName)

Accetta caratteri jolly?

false

-TraceRoute

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

Alias

nessuno

Obbligatorio?

false

Posizione?

named

Valore predefinito

nessuno

Accetta input da pipeline?

false

Accetta caratteri jolly?

false

<CommonParameters>

Questo cmdlet supporta i parametri comuni: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer e -OutVariable. Per altre informazioni, vedere   about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Input

Il tipo di input è il tipo degli oggetti che è possibile reindirizzare al cmdlet.

  • none

Output

Il tipo di output corrisponde al tipo di oggetti generati dal cmdlet.

  • NetConnectionResults

    Results of the connectivity test to the specified computer name

Esempi

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