Test-NetConnection is a powerful Windows PowerShell command that allows users to check the network connection status of a local or remote computer. It can be used to troubleshoot network connectivity issues, determine the latency of a connection, and even identify the type of network protocol used. In this guide, we will discuss the syntax, parameters, inputs, outputs, examples, and tips for using Test-NetConnection.
Syntax
The syntax for Test-NetConnection is as follows:
Test-NetConnection [-ComputerName] <String> [-Port] <Int32> [-InformationLevel <String>] [-CommonTCPPort] [-TraceRoute] [-Hops <Int32>] [-BufferSize <Int32>] [-TimeToLive <Byte>] [-Source <String>] [-Continuous] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob] [-CimClass <CimClass>] [-CimNamespace <String>] [-Property <String[]>] [-Authentication <AuthenticationMechanism>] [-Credential <PSCredential>] [-CertificateThumbprint <String>] [-Certificate <X509Certificate>] [-UseSSL] [-IncludeEchoReply] [-IncludeTimestamp] [-IncludeSourceRoute] [-IncludeIPv4] [-IncludeIPv6] [-IncludeLinkLayer] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
Parameters
The parameters for Test-NetConnection are as follows:
Parameter | Description |
---|---|
-ComputerName | Specifies the name of the computer to test the connection to. |
-Port | Specifies the port to test the connection to. |
-InformationLevel | Specifies the level of information to be returned. |
-CommonTCPPort | Specifies that the port is a common TCP port. |
-TraceRoute | Specifies that a trace route should be performed. |
-Hops | Specifies the maximum number of hops for the trace route. |
-BufferSize | Specifies the size of the buffer for the trace route. |
-TimeToLive | Specifies the time to live for the trace route. |
-Source | Specifies the source IP address for the trace route. |
-Continuous | Specifies that the trace route should be continuous. |
-CimSession | Specifies the CimSession to use for the trace route. |
-ThrottleLimit | Specifies the throttle limit for the trace route. |
-AsJob | Specifies that the trace route should be run as a background job. |
-CimClass | Specifies the CimClass to use for the trace route. |
-CimNamespace | Specifies the CimNamespace to use for the trace route. |
-Property | Specifies the properties to be returned for the trace route. |
-Authentication | Specifies the authentication mechanism to be used for the trace route. |
-Credential | Specifies the credentials to be used for the trace route. |
-CertificateThumbprint | Specifies the certificate thumbprint to be used for the trace route. |
-Certificate | Specifies the certificate to be used for the trace route. |
-UseSSL | Specifies that SSL should be used for the trace route. |
-IncludeEchoReply | Specifies that the echo reply should be included in the trace route. |
-IncludeTimestamp | Specifies that the timestamp should be included in the trace route. |
-IncludeSourceRoute | Specifies that the source route should be included in the trace route. |
-IncludeIPv4 | Specifies that IPv4 should be included in the trace route. |
-IncludeIPv6 | Specifies that IPv6 should be included in the trace route. |
-IncludeLinkLayer | Specifies that the link layer should be included in the trace route. |
-Force | Specifies that the trace route should be forced. |
-WhatIf | Specifies that the trace route should be simulated. |
-Confirm | Specifies that the trace route should be confirmed. |
Inputs
The inputs for Test-NetConnection are as follows:
- ComputerName: The name of the computer to test the connection to.
- Port: The port to test the connection to.
- InformationLevel: The level of information to be returned.
- CommonTCPPort: Whether the port is a common TCP port.
- TraceRoute: Whether a trace route should be performed.
- Hops: The maximum number of hops for the trace route.
- BufferSize: The size of the buffer for the trace route.
- TimeToLive: The time to live for the trace route.
- Source: The source IP address for the trace route.
- Continuous: Whether the trace route should be continuous.
- CimSession: The CimSession to use for the trace route.
- ThrottleLimit: The throttle limit for the