2.1.5. Use the appropriate Microsoft command-line tools. (Obj. 1.5)
💡 First Principle: The command line offers powerful, direct control for efficient troubleshooting and administration that is often faster than using the GUI.
The command-line interface (CLI) is an essential tool for any serious IT technician. While the GUI is great for visual tasks, the CLI provides a faster, more direct, and often more powerful way to interact with the operating system, especially for networking and system file tasks. Windows provides two main CLI environments: the traditional Command Prompt (cmd.exe) and the more modern and powerful PowerShell. For the A+ exam, you must be familiar with a core set of commands that are used for everyday diagnostics and repair. Remember, for many of these commands to work correctly, you must run the CLI "As Administrator" by right-clicking it and selecting that option.
Figure: The Windows Command Prompt - a powerful interface for network diagnostics and system repair
- Networking:
ipconfig: The most fundamental networking command. Use it to quickly view the IP address, subnet mask, and default gateway. Useipconfig /allto see detailed information, including MAC addresses and DNS server addresses.ipconfig /releaseand/reneware used to get a new IP address from a DHCP server.ipconfig /flushdnsclears the local DNS cache, which can resolve browsing issues.ping: Tests basic connectivity to another device (e.g.,ping 8.8.8.8orping www.google.com). It sends a small packet and waits for a reply. If you get a reply, you know there is a network path between you and the destination.tracert: Traces the "hops" (routers) a packet takes to reach a destination. Useful for diagnosing where a network connection is failing along the path.netstat: Displays active network connections, listening ports, and network statistics.netstat -anis useful for seeing all connections and the ports they are using.route print: Displays the local routing table - which network destinations go out which interface and via which gateway (netstat -rshows the same table).arp -ashows IP-to-MAC mappings instead.nslookup: Queries DNS directly to test name resolution. Ifpingby IP address works butnslookupcannot resolve the name, the fault is DNS, not connectivity.pathping: Combinespingandtracert, measuring packet loss at each hop (it takes much longer).net use: Maps or disconnects network shares, e.g.,net use X: \\Server1\Share(add/persistent:yesto reconnect at every sign-in).
- System & Disk:
sfc(System File Checker): A critical repair tool.sfc /scannowscans all protected Windows system files and replaces any that are corrupt or missing with a cached copy.chkdsk(Check Disk): Scans a disk's file system for logical errors.chkdsk /fattempts to fix any errors it finds.chkdsk /rlocates bad sectors on the disk and attempts to recover readable information (this implies/f).diskpart: A powerful CLI tool for advanced disk and partition management, allowing you to do everything Disk Management can do, but from the command line.gpupdate /force: In a corporate domain environment, this command forces the client to immediately contact the domain controller and re-apply any Group Policy settings.gpresult /r: Shows which Group Policies are currently being applied to the user and computer, which is invaluable for troubleshooting policy-related issues.format: Formats a volume from the command line, e.g.,format E: /FS:NTFS /V:Data(/FS:sets the filesystem,/V:the volume label,/Qmakes it a quick format).- Inside
diskpart, youlist diskandselect disk N, thencleanremoves all partition and volume information from that disk, beforecreate partition primary,format fs=ntfs quick, andassign letter=E. DISM /Online /Cleanup-Image /RestoreHealth: Repairs the Windows component store (using Windows Update) thatsfctakes its replacement files from. Ifsfcreports that it cannot fix some files, run DISM first, thensfc /scannowagain. (/CheckHealthand/ScanHealthonly report corruption.)bootrec(run from the Windows Recovery Environment's Command Prompt when Windows won't boot):/fixmbrwrites a new master boot record without overwriting the partition table,/fixbootwrites a new boot sector, and/rebuildbcdthen scans for Windows installations and rebuilds the Boot Configuration Data (BCD) store./fixmbrapplies only to legacy BIOS/MBR disks.
- Navigation & File Management:
cdchanges directory anddirlists its contents;md(mkdir) makes a new directory andrmdirremoves one;robocopy(Robust File Copy) copies whole directory trees reliably (/Eincludes empty subfolders,/COPYALLpreserves NTFS permissions and ownership,/MIRmirrors), superseding the olderxcopyandcopy. - Informational:
hostnameshows the computer name;whoamishows the signed-in user (e.g.,CORP\jsmith);net userlists or manages user accounts;winveropens the About Windows box with the exact version and build;tasklistlists running processes from the CLI (taskkillends one);query user /server:PC-101lists the sessions signed in on a remote PC; and any command followed by/?shows its help.
Technician's Diagnostic Path: Scenario: A user calls and says they suddenly can't access the company intranet site or any network shares, but they believe their internet is working because they can get to Google.
- Initial Test (ping by name): Open a command prompt. The first step is to test name resolution. Type
ping intranet.corp.local(replacing with the actual intranet server name). If this fails, it suggests a DNS problem. - Isolate the Issue (ping by IP): Ask a colleague for the IP address of the intranet server (e.g.,
10.10.5.20). Now,ping 10.10.5.20. If this ping succeeds while the ping by name failed, you have confirmed the issue is with DNS. The user has connectivity to the internal network but cannot resolve internal names. - Gather More Data (
ipconfig /all): Runipconfig /all. Examine the output for the "DNS Servers" line. You might find that the user's machine is pointing to a public DNS server (like8.8.8.8) instead of the required internal corporate DNS server. This would explain why they can reach external sites (Google) but not internal ones. - Implement the Fix: Based on this finding, go into the user's network adapter's IPv4 properties and manually set the correct internal DNS server address.
- Verify (
ipconfig /flushdnsand ping): Runipconfig /flushdnsto clear out any bad cached entries. Then,ping intranet.corp.localagain. It should now succeed, and the user should be able to access all internal resources.
Reflection Question: You are troubleshooting a "no internet" issue. You use ipconfig and see the user has an IP address of 169.254.10.20. What does this tell you, and what is your next troubleshooting step?