Test-NetConnection

Test-NetConnection

Displays diagnostic information for a connection.

Синтаксис

Parameter Set: CommonTCPPort
Test-NetConnection [[-ComputerName] <String> ] [-CommonTCPPort] <String> {HTTP | RDP | SMB | WINRM} [-InformationLevel <String> {Quiet | Detailed} ] [ <CommonParameters>]

Parameter Set: ICMP
Test-NetConnection [[-ComputerName] <String> ] [-Hops <Int32> ] [-InformationLevel <String> {Quiet | Detailed} ] [-TraceRoute] [ <CommonParameters>]

Parameter Set: RemotePort
Test-NetConnection [[-ComputerName] <String> ] -Port <Int32> [-InformationLevel <String> {Quiet | Detailed} ] [ <CommonParameters>]

Подробное описание

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.

Параметры

-CommonTCPPort<String>

Specifies the common service TCP port number. Допустимые значения для этого параметра следующие:

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

Псевдонимы

none

Обязательное поле?

true

Позиция?

2

Значение по умолчанию

none

Принимать входные данные конвейера?

false

Обрабатывать символы-шаблоны?

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.

Псевдонимы

RemoteAddress,cn

Обязательное поле?

false

Позиция?

1

Значение по умолчанию

none

Принимать входные данные конвейера?

True (ByValue, ByPropertyName)

Обрабатывать символы-шаблоны?

false

-Hops<Int32>

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

Псевдонимы

none

Обязательное поле?

false

Позиция?

named

Значение по умолчанию

none

Принимать входные данные конвейера?

false

Обрабатывать символы-шаблоны?

false

-InformationLevel<String>

Specifies the information level. Допустимые значения для этого параметра следующие:

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

Псевдонимы

none

Обязательное поле?

false

Позиция?

named

Значение по умолчанию

none

Принимать входные данные конвейера?

false

Обрабатывать символы-шаблоны?

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.

Псевдонимы

RemotePort

Обязательное поле?

true

Позиция?

named

Значение по умолчанию

none

Принимать входные данные конвейера?

True (ByPropertyName)

Обрабатывать символы-шаблоны?

false

-TraceRoute

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

Псевдонимы

none

Обязательное поле?

false

Позиция?

named

Значение по умолчанию

none

Принимать входные данные конвейера?

false

Обрабатывать символы-шаблоны?

false

<CommonParameters>

Этот командлет поддерживает общие параметры: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer и -OutVariable. Дополнительные сведения см. в разделе  about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Входы

Входной тип — это тип объектов, которые можно направить в командлет.

  • None

Выходные данные

Возвращаемый тип — это тип объектов, возвращаемых командлетом.

  • NetConnectionResults

    Results of the connectivity test to the specified computer name.

Примеры

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