Command Line Heroes: Diagnose PC Problems with Ping and Driverquery

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 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 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:

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. If Ping gets responses for the IP address but not the domain name, a domain name server (DNS) failure is probably at issue. If 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, be it 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, including 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.