Time to bury Ping, Telnet, NSlookup and Tracert on Windows

Have you ever or still use any of this commands  to troubleshoot ? Ping, Telnet, NSlookup, Tracert. Did you know there are PowerShell cmdlets that can do all that and better ?

1. PING

ping

YOUR NEW FRIEND TEST-CONNECTIONtest-connection.JPG

2. TELNET

Before give you an example of telnet have you ever got this error  “‘Telnet’ is not recognized as internal or external command, operable program or batch file”telnet

Well this should be a thing of the past and there is no need to install telnet client on your machine.

MEET Test-NetConnectiontest-netconnection

There are two important things here, first pay attention to TcpTestSucceeded and look out for the True value.  This cmdlet will also do ping  and show a status of true or false next to PingSucceded

Let me show you an output when the port is closetest-netconnection2

As you can see the TcpTestSuceeded is equal false and you will  get a warning message that TCP connect failed. Also take note that PingSucceded is true because ICMP stills works on http://www.powershell.org.

3. TRACERTtracert

Let use Test-NetConnection again and just add the -TraceRoute parameter

tracert2

I think you get a cleaner output and it is faster to execute it. Test-NetConnection only took 4.3 seconds to complete and tracert took 50 seconds.

4. NSLOOKUP

I usually use nslookup to find A records resolution and/or mx records resolution. I will give you an example with mx records

nslookup.JPG

To find information about mx records I always had to type nslookup then wait like 2 seconds, then set type=mx and finally type the domain name.

Now let me show you a simpler way using  Resolve-DNSNameresolve-dnsname

I have to use one line to find that the mx record, simple enough. Now  let’s say you need to find all txt recordstext.JPG

Keep in mind these cmdlets are only available on Windows 2012 R2 or Windows 8.1 and higher.

 

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s