Command Line Heroes: Diagnose PC Problems with Command Line Ping and Driverquery

By ·Categories: Tech Explained·Published On: January 20th, 2022·5.2 min read·

Looking to diagnose your PC problems like intolerable system slow downs, sudden blue screen crashes, and wonky network connections that stall browsers and email? These are the kinds of everyday annoyances that can bedevil PC users. And, they are the type of issues that our support team spend a significant portion of our time helping clients work through. It doesn’t have to be that way.

Windows includes a number of built-in applications and command-line utilities that let you explore PC subsystems and sleuth out problems yourself. There is, frankly, a whole ecosystem of useful, free tools, utilities and programs out there for the budding IT self-server. Today we’ll focus on two such utilities that are included within Windows itself and are easily accessed from the Windows Command Prompt console.

The Joy of Command Line Ping

DOS may be long gone, but its spirit lives on in the Windows Command Prompt console, present in every version of Windows going back to Windows 95. To launch the console window, click the Windows key on the Taskbar, type “cmd.exe” in the text box and press Enter. An application window opens to present the classic C:\> prompt. Just like old times.

From here, you can launch Ping, a command line utility that sends packets through your PC’s network interface to an IP address or domain you specify, and then listens for a response. Just enter the command “ping” followed by the IP address or domain name. For example:

ping google.com

By default, Ping sends out four ICMP Echo Requests, then displays the status of each response and the time the communication took in milliseconds. It also summarizes the results of the ping session. Here’s what you see:

Pinging google.com [172.217.2.14] with 32 bytes of data:
Reply from 172.217.2.14: bytes=32 time=26ms TTL=55
Reply from 172.217.2.14: bytes=32 time=24ms TTL=55
Reply from 172.217.2.14: bytes=32 time=25ms TTL=55
Reply from 172.217.2.14: bytes=32 time=24ms TTL=55

Ping statistics for 172.217.2.14:
     Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
     Minimum = 24ms, Maximum = 26ms, Average = 24ms

Ping for Troubleshooting

Ping is a great troubleshooting tool. If a certain website won’t load in your browser, you can ping the IP address first, then the domain name. Then, if Ping gets responses for the IP address but not the domain name, a domain name server (DNS) failure is probably at issue. In the event that both fail or timeout, you know the issue isn’t with your web browser or other software.

Intermittent network failures can be the hardest – and most frustrating – to diagnose. The solution: Have Ping run a steady stream of packets by using the -t switch. This causes Ping to work until the user enters Ctrl-C to halt the session. Whether that happens after an hour or overnight. Or use the -n switch followed by the number of pings you want sent in the session – Ping will stop once that number is reached. To capture all this data, tell Ping to write its results to a text file in your User subdirectory, like this:

ping google.com -t > pngoutpt.txt

Let’s say your PC is having connectivity hiccups. A faulty network interface could be the culprit. However, many systems have multiple interfaces – a couple network ports and a WiFi interface, for example. To narrow things down, disable all but one network interface and run an extended Ping session (again, using the -t or -n switch, as you prefer). Then do the same thing for each of the other ports. Compare the saved results and see if Ping encountered a higher percentage of lost packets on any of the interfaces. If so, you’ve found your problem.

Dive Into Driverquery

Driver software is the stuff that lets Windows talk to system hardware. It’s low-level code, often written in painstaking fashion for peak efficiency. And, it can be the source of many a problem, from a disabled mouse to unpredictable system crashes. When trouble occurs, corrupt, buggy or just old drivers can be the root cause of the problem. To keep tabs on exactly what drivers are installed on your system, type driverquery at the Command Prompt. You’ll see a long list of every installed driver (and there are a lot!), including descriptive information and date. This last bit of information is important, since you can use it to keep track of the update history of drivers on each PC.

The /v switch causes Driverquery to produce a far more detailed list, which includes driver file name, location, size, date and other data. It also provides status information on the driver, such as whether it is launched at system boot or not. As with Ping, it’s helpful to write the results to a log file. Use the /fo switch to render the file in spreadsheet-friendly CSV format, as shown in the input below:

driverquery /v /fo csv > drvqry-20160927.csv

Run this type of query every couple months and save the results, making sure to include the date of the query in each file name. Now it’s a simple matter of comparing spreadsheets to see if any changes occurred in your driver inventory over time.

Getting Graphical

There are a host of other command line utilities you can access. Systeminfo produces a useful text-based inventory of your system. It will include OS version, computer model name, processor type, BIOS date and version, and available network interfaces. It also lists a rundown of installed Windows hotfixes. Tracert is similar to Ping, but it lists all the network hops needed for packets to travel from your PC to a target host – useful for diagnosing where remote network communications are getting hung up.

Beyond the command line, Windows offers a fleet of apps and utilities for managing your PC. Most of these are graphical Windows applications that can be launched from the Start menu. Be sure to check out our rundown of Windows Resource Monitor and Windows Event Viewer, two more very useful tools. Resource Monitor lets you keep an eye on how your system is behaving, while Event Viewer lets you see what your system has done.

Note: Our support team originally wrote this blog on September 27th, 2016. The team reviewed and updated it on January 20, 2022. 

Download white paper to learn how fanless computers can help your business

 

Get the Latest Tech Updates

Subscribe to our newsletters to get updates from OnLogic delivered straight to your inbox. News and insights from our team of experts are just a click away. Hit the button to head to our subscription page.

Share

About the Author: Nathan Schramm

Nathan is part of OnLogic's Technical Support team. He helps customers remove technical blockers to make their applications successful. When he's not at work, he likes to play with servers in his home lab, work on his car, and hang out with his cats.