Let's face it, it is compact, a low security risk to have installed, but it having not been included by default on modern Operating Systems has forced me to memorize import-servermanager and add-windowsfeature telnet-client (and before that servermanagercmd -i telnet-client)
The fact that I can iterate those without looking them up is practically a sign that the tool might need a refresh.
Enter Test-NetConnection. Now, I won't claim to have discovered or wrote it, but I use PowerShell daily and just learned of it today.
It's new since Windows 8.1 and Windows 2012 R2, which came with PowerShell 4.0.
Like I said - nothing new - it's already been called the SuperPing once.
So what can we do with it?
First off, run it alone is a basic Internet connectivity test using just test-netconnection. This reaches out to a server at Microsoft to see if you are online. Great to use programatically like this:
if (test-netconnection) {
# Download stuff
} else {
# Error about your Internet
}
You can also use it to check specific connectivity using something like:
Test-NetConnection -ComputerName edge.extrateam.com -Port 5061 -InformationLevel Detailed -Verbose
Some additional tips:
- -ComputerName can be shortened to -CN
- -commonport can be used for things like RDP, HTTP, SMB and PING
- -traceroute can also be used to display hops to a destination, and -hops can be used to specify the maximum hops to be displayed
As you can see, this gives us a BUNCH of great information:
- Multiple DNS records returned (only shown with the Detailed InformationLevel)
- Which IP we connected to
- And a successful TCP test!
No comments:
Post a Comment