Windows Server presents tons of instruments for admins in case an utility or pc isn’t in a position to hook up with a particular port or server IP. One factor that immediately pops up is utilizing instruments to resolve DNS and different community points, however should you love utilizing PowerShell, there’s a good command Test-NetConnection that you should use.
Troubleshoot Network connectivity points by way of PowerShell
You can use the Test-NetConnection cmdlet to search out out diagnostic data for a connection. It contains help for the Ping take a look at, TCP take a look at, route tracing, and in addition route choice diagnostics.
Depending on which choices are used, the output will consist of data comparable to LaptopName, RemoteAddress, ChosenSourceHandle, OutgoingInterfaceIndex, SelectedNetRoute, and extra.
Here is the record of supported parameters
- CommonTCPPort: Specifies the standard service TCP port quantity
- LaptopName: Specifies the Domain Name System (DNS) identify or IP tackle of the goal pc.
- ConstrainInterface: Specifies the interface constraint to make use of for route diagnostics.
- ConstrainSourceHandle: Specifies the supply tackle constraint to make use of for route diagnostics.
- DiagnoseRouting: Indicates that route diagnostics run to output the route and supply tackle choice data for the distant host.
- Hops: Specifies the variety of hops to traverse in a traceroute command.
- InformationLevel: Specifies the data stage Detailed or Quiet
- Port: Specifies the TCP port quantity on the distant pc.
- TraceRoute: Indicates that Tracert runs to check connectivity to the distant host.
Using the highly effective Test-NetConnection cmdlet
Test-NetConnection -LaptopName "www.contoso.com" -ConstrainInterface 5 -DiagnoseRouting -InformationLevel "Detailed" LaptopName : www.contoso.com RemoteAddress : 2600:1409:a:185::2768 ConstrainInterfaceIndex : 5 ChosenSourceHandle : 2001:4898:e0:79:75dd:64cf:d9ff:f86 OutgoingInterfaceIndex : 5 SelectedNetRoute : DestinationPrefix: ::/0 NextHop: fe80::200:5eff:fe00:202 RouteSelectionEvents : IP: Route [DestinationPrefix: ::/0 NextHop: fe80::200:5eff:fe00:202 InterfaceIndex: 4 RouteMetric: 256] is blocked for Destination: 2600:1409:a:185::2768 ConstrainInterfaceIndex: 5 ConstrainScopeZone: 1 in Compartment: 1, Reason: InterfaceConstraint. SourceAddressSelectionEvents : IP: Source tackle 2001:4898:e0:79:75dd:64cf:d9ff:f86 is most popular over fe80::75dd:64cf:d9ff:f86 for vacation spot 2600:1409:a:185::2768 Rule = 2.0. IP: Source tackle 2001:4898:e0:79:75dd:64cf:d9ff:f86 is most popular over fe80::75dd:64cf:d9ff:f86 for vacation spot 2600:1409:a:185::2768 Rule = 2.0. RouteDiagnosticsSucceeded : True
List of Sample Commands
Here are a couple of pattern instructions you possibly can attempt in your pc. Some of those instructions will want admin privileges, so make certain to launch PowerShell 7 or PowerShell 5.1 with the required permission.
More detailed data on the connectivity:
Test-NetConnection youtube.com -InformationLevel "Detailed"
When working with net providers, it’s to check a particular TCP port.
Test-NetConnection youtube.com -Port 443 -InformationLevel "Detailed"
Perform route diagnostics to hook up with a distant host.
Test-NetConnection -LaptopName itopstalk.com -DiagnoseRouting -InformationLevel Detailed
Find the default port of a web site
Test-NetConnection -LaptopName microsoft.com -CommonTCPPort HTTP
Run Trace Route for a web site
Test-NetConnection -LaptopName google.com -TraceRoute
That stated, it’s useful if you’re on a non-windows platform however makes use of the identical command as in Windows.
Apart from this, I’ve additionally seen executing instructions for some web sites like Microsoft.com. It doesn’t work. Ping fails on a regular basis, which might be a server factor blocking such random requests.
- Tags: Network, PowerShell