Tip

Selecting the top Windows 7 command-line utilities

Solutions provider takeaway: Sifting through the massive number of Windows 7 command-line utilities isn't easy, but these are the utilities that are vital to performing Windows 7 management tasks. Commands such as arp can help solution providers view important information for their customers.

    Requires Free Membership to View

To accomplish administration tasks on Windows 7 machines, it is necessary to use the command line from time to time. You can easily access this essential runtime environment in Windows 7 with the Search box at the foot of the Start menu. Typing cmd into this box and hitting the Enter key will display the command line's old fashioned but useful black-and-white DOS box, which is displayed in Figure 1.

Figure 1: The black-and-white DOS box is still useful for typing commands into a customer's environment.

For solution providers that need to run a command prompt with elevated privilege, instead of hitting the Enter key after typing cmd, they can right-click the cmd icon that shows up in the search results. From there, providers can select Run as administrator from the resulting pop-up menu. This is necessary when using the vssadmin command to resize volume shadow storage allocations, which will be covered later in this article.

Key command-line resources

There are hundreds of command-line utilities in the Windows runtime environment. One of the best resources for them is the Microsoft Command-Line Reference. The reference was last updated on Jan. 25, 2010, and it documents 226 individual command-line tools, some of which are complex enough to warrant extensive user guides.

For example, check out these commands:

  • fsutil
  • netsh,
  • Various net commands, such as net computer, net group, net localgroup, net print and net user).

Another terrific command-line resource that's useful to providers is the Overview of TCP/IP Troubleshooting Tools, which covers the items in my table of top commands in the next section. The command shell overview, despite not being updated since the Windows Server 2003 release, is also worth reading thoroughly, especially for solution providers that need to script out command sequences.

Ed's "Top 11" command-line utilities

While I was researching command-line utilities, I kept track of the ones I use regularly and also reviewed the whole collection of commands documented in the references mentioned above. This helped me produce a list of 11 personal command-line favorites I couldn't do without and the ones that solution providers may need in Windows 7. Table 1 lists them in alphabetical order.

Table 1: The 11 essential Windows command-line utilities

Name

Description

Arp

"Address Resolution Protocol" maps media/hardware addresses to local IP addresses

Chkdsk

Checks hard disks for file system corruption, file defects and other structure issues

Chkntfs

Manages automatic disk checking that occurs when Windows starts up

Ipconfig

Checks and sets various IP configuration items, including DHCP leases and addresses

Nbtstat

Checks and troubleshoots NetBIOS name resolution settings and behavior

Netstat

Displays active TCP connections, TCP/UDP ports, Ethernet statistics, IP routing table and more

Ping

Uses ICMP echo to assess reachability of nodes by IP address or NetBIOS names

Set

Sets or shows Windows environment variable values

Tasklist

Displays the list of processes running on a Windows PC

Vssadmin

Displays and manages volume shadow copy behavior on a Windows PC

Whoami

Displays computer and account names related to your current log-in session

ARP (Address Resolution Protocol)

Use the arp command to show which nodes on your local subnet have interacted with the machine in which you run the command. Figure 2 below shows reasonably complete coverage of my home network.

Figure 2: Find out which nodes have interacted with the machine where you run the ARP command.

Chkdsk

Solution providers can use this command to monitor and repair local file systems and related file system metadata on a per-volume basis, including logical and physical errors. Most Windows configurations run chkdsk on all attached volumes each time Windows boots up. Without parameters, this command reports on-target Windows drives, as shown, but it can also be used to repair a wide range of issues.

Figure 3: A variety of issues can be repaired with chkdsk.

Chkntfs

Chkntfs uses the Windows Autochk.exe program to scan volumes to see if the volume dirty bit has been set, which indicates inspection and possible repair is warranted. If so, it runs chkdsk /f to find and repair any potential issues during inspection. This command runs by default each time Windows boots, but you can use the command to exclude chosen volumes from the checks.

Figure 4: Determine whether your disk requires inspection with the chkdsk command.

Ipconfig

This command-line utility monitors various Windows TCP/IP configuration options and settings, and is the main reason you would access the Command Prompt window. This tool tells you what you need to know about network configuration data and also provides a ready means to manage DHCP address leases using its /release and /renew parameters. Solution providers that work with networks will use this command frequently.

Figure 5: Get detailed information about your customer's network configuration data.

Nbtstat

This cryptic string stands for statistics about NetBIOS over TCP/IP, and even though NetBIOS isn't used much for applications anymore, it's a vital element for Windows network communications and activities. The screen cap in Figure 6 lists the NetBIOS names registered on the machine where it's run (-r).

Figure 6: Providers can use this command to get Windows network statistics.

Netstat

Netstat stands for network statistics and reports on active TCP connections, open TCP and UDP ports, Ethernet statistics, protocols in use, routing table contents and general protocols in use. The screen cap in Figure 7 shows Ethernet statistics for the machine on which it's run (-e).

Figure 7: This command reports on various protocols for providers.

Ping

The ping command uses ICMP echo to see if specific nodes on a network are available by name or by IP address and, if so, the amount of time needed for a short message to make a round trip between the sender and the receiver. Ping is useful for network troubleshooting, especially when problems with Internet access arise. The screen cap in Figure 8 shows access to a working node, and failed access to a nonworking one.

Figure 8: The ping command helps solution providers manage customer networks.

Set

Set lets users examine, add or alter environment variables in the Windows runtime environment. These values include objects such as the directory path, the Windows home drive and directory and all kinds of important values and directory pointers.

The set command is also helpful when you're looking for information about a particular Windows installation or when you need to change basic defaults or filesystem behaviors. Run without parameters, set displays all current variables and their value assignments, as the Figure 9 screen cap illustrates.

Figure 9: Changed basic defaults easily with the set command.

Tasklist

The tasklist command shows all active processes running on your customer's local or remote Windows PC (Figure 10). It's a practical way to access and record information about active processes, and may be used to feed valuable information into scripts or management consoles. It also tells you about dlls and services associated with specific processes, and includes different types of interesting filters and formatting/output controls.

Figure 10: Get the list of your customer's active processes with tasklist.

Vssadmin

This command provides access to information that's related to the Windows Volume Shadow Copy Service (VSS). VSS is a collection of semi-hidden files related to restore points, shadow copies, as well as writers and providers of these copies. It's particularly useful to solution providers that need help reining in Vista's large appetite for shadow copy space (30% of a hard drive, by default) and managing shadow copies on solid-state disks (SSDs).

Figure 11: View information on VSS on your customer's disk with the vssadmin command.

Whoami

If you're constantly working on multiple Windows machines, or one of many Windows virtual machines on your customers' PCs, this command gives you the machine name (to the left of the slash) and the login account name (to the right of the slash) in its brief but informative output. The next screen cap in Figure 12 shows you what this output looks like.

Figure 12: Get all of the pertinent Windows VM and account information with the whoami command.

More Windows 7 command-line tools to choose from

The aforementioned commands are my personal favorites, but there are plenty of other useful and powerful elements in the Microsoft command-line references listed earlier in this tip.

Ed Tittel is a frequent contributor to numerous TechTarget websites and also writes regularly for InformIT.com and ITExpertVoice.com. He has contributed to well over 100 computer books, including Windows 7 In Depth (Que, 2009, ISBN: 0789741997) and Guide to TCP/IP 3e (Course Technology, 2006, ISBN: 1418837555).


This was first published in September 2010

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.