Test-NetConnection is a PowerShell cmdlet that checks and then displays cookies about a network connection to another computer/server on the same network or a web server on the Internet.
How to Use Test-NetConnection?
The “Test-NetConnection” command will be used via PowerShell. The Test-NetConnection command has some features other than just pinging. You can see them below.
When we use this command alone, what it does is PING a web beacon and display the result whether successful or not.
(Test-NetConnection -InformationLevel “Detailed“) the command gives your local IP address. It also shows what your router’s IP address is.
“-Port” and “-ComputerName” Commands
You can check whether the relevant port of the opposite system is open by specifying the desired port number with the “-port” command. In other words, it is to provide port-based control.
An address can be specified using the “-ComputerName” command.
Test-NetConnection -port 80 -ComputerName "systemconf.com" -InformationLevel "Detailed"
-CommonTCPPort “port name”
You can also use the port name if you want. But you can only try the following port names.
Below you can see the shorter version of the same command. In other words, it is to provide port-based control.
Test-NetConnection systemconf.com -port 80
“ -InformationLevel Quiet” Command
The result section can be shortened further with the ” -InformationLevel Quiet” command. If the answer is “True”, it means the port is open, and “False” means the port is closed.
You can do a TraceRoute with Test-NetConnection to list all the network hops used to go to the target computer.
Test-NetConnection systemconf.com -TraceRoute