Test Windows Network Connectivity with Test-NetConnection
When troubleshooting network connectivity issues on a Windows system, the Test-NetConnection
PowerShell cmdlet can be a valuable tool. It allows you to test network connectivity to a specific host and port, providing useful information for diagnosing and resolving issues. Here’s an example of how to use Test-NetConnection
:
Test-NetConnection -ComputerName www.google.com -Port 443 -InformationLevel "Detailed"
This command will test the network connection to the host www.google.com
on port 443. The -InformationLevel "Detailed"
parameter provides more detailed information in the output.
ComputerName : www.google.com
RemoteAddress : 172.217.2.196
RemotePort : 443
NameResolutionResults : 172.217.2.196
2607:f8b0:4008:80a::2004
MatchingIPsecRules :
NetworkIsolationContext : Internet
IsAdmin : False
InterfaceAlias : Wi-Fi 2
SourceAddress : 10.0.0.181
NetRoute (NextHop) : 10.0.0.1
TcpTestSucceeded : True
The output from Test-NetConnection
will provide valuable insights into the network connectivity. In the example provided, the output confirms whether the host was able to resolve the IP address from the hostname, if the TCP connection was successful, and if the ping test was successful. If the resolution or ping test fails, the function will notify you accordingly.
To learn more about the Test-NetConnection
cmdlet and its capabilities, you can refer to the official Microsoft documentation.