TEC-ITS43-03 · Lesson 5 · 12.5 clock hours · practice
Windows Command-Line and PowerShell Essentials
Objective. Students will use Command Prompt and PowerShell to perform disk management, file operations, network diagnostics, and system information tasks required for A+ Core 2 exam scenarios.
⚠ Pending professional review
This lesson, its worked examples and its practice questions has not yet been verified by an industry-certified professional or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.
VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.
Why the Command Line Still Matters
Graphical tools are convenient, but many real-world support tasks are faster, scriptable, and more precise at the command line. Both CompTIA A+ Core 2 and Cisco CCST/CCNA expect you to use Command Prompt and PowerShell fluently. Hiring managers consistently report that candidates who can troubleshoot from the CLI stand out. Learn these tools now and you will carry them throughout your career.
Command Prompt Fundamentals
Command Prompt (`cmd.exe`) is the traditional Windows shell. It runs commands sequentially and is available on every modern Windows version. You must understand the following commands for the A+ Core 2 exam and daily support work.
Navigation and File Operations
- `dir` — lists files and folders in the current directory. Add `/a` to show hidden files or `/s` to recurse into subfolders.
- `cd` — changes the current directory. `cd ..` moves up one level.
- `mkdir` / `rmdir` — create or remove directories.
- `copy`, `move`, `del` — copy, move, or delete files.
Disk Management
- `chkdsk C: /f /r` — scans the selected volume for file-system errors (`/f` fixes them) and bad sectors (`/r` locates and recovers data). Run this from an elevated prompt; the system may schedule the scan for the next reboot on a live volume.
- `diskpart` — an interactive sub-shell for advanced disk and partition management. Common sub-commands: `list disk`, `select disk #`, `list partition`, `create partition primary`, `format fs=ntfs quick`, `assign`. Use diskpart with extreme caution — the wrong target disk will destroy data with no undo.
- `sfc /scannow` — System File Checker scans protected Windows system files and replaces corrupted ones from a cached copy. Must be run from an elevated (Administrator) Command Prompt.
Network Diagnostics
- `ipconfig` — displays IP configuration. `/all` adds MAC address, DHCP server, DNS servers, and lease information. `/release` and `/renew` cycle a DHCP lease. `/flushdns` clears the DNS resolver cache.
- `ping` — tests reachability and round-trip latency to a host. `ping 127.0.0.1` tests the local TCP/IP stack. Add `-t` for a continuous ping; press Ctrl+C to stop.
- `tracert` — traces the route packets take to a destination, showing each router hop and latency. Useful for identifying where a connection is failing.
- `netstat` — displays active TCP/UDP connections and listening ports. `-a` shows all connections and listening ports; `-n` shows numeric addresses instead of hostnames; `-b` (requires elevation) shows the executable associated with each connection.
- `nslookup` — queries DNS to resolve hostnames to IP addresses or look up DNS records.
PowerShell Essentials
PowerShell is a modern shell and scripting language built on .NET. It uses cmdlets (pronounced "command-lets") with a consistent `Verb-Noun` syntax. PowerShell is the preferred tool for automation, bulk operations, and system inventory.
Key cmdlets for support work
- `Get-Command` — lists available cmdlets.
- `Get-Help <cmdlet>` — displays documentation. Add `-Examples` for usage samples.
- `Get-NetIPConfiguration` — equivalent to `ipconfig /all` but returns structured objects.
- `Test-NetConnection` — replaces ping for scripting; supports port testing with `-Port`.
- `Get-Disk`, `Get-Partition`, `Get-Volume` — disk and volume information.
- `Get-Service` — lists Windows services and their status. Filter with `Where-Object`: `Get-Service | Where-Object {$_.Status -eq 'Running'}`.
- `Get-ComputerInfo` — returns a comprehensive system inventory including OS version, BIOS, memory, and CPU details. You can pipe this to `Out-File` to save it: `Get-ComputerInfo | Out-File C:\inventory.txt`.
- `New-Item -ItemType Directory` — creates folders.
- `Set-Acl` — sets file and folder permissions (Access Control Lists).
Running scripts safely: PowerShell's execution policy controls whether scripts run. The default is often `Restricted`. For lab work, an instructor may set it to `RemoteSigned` with `Set-ExecutionPolicy RemoteSigned`. Never lower the policy to `Unrestricted` on a production machine. Always read a script before running it.
Elevation and Least Privilege
Many commands require an elevated (Administrator) prompt. Right-click Command Prompt or PowerShell and choose Run as administrator. Follow the principle of least privilege: use a standard account for everyday work and elevate only when the task requires it. Running everything as Administrator increases risk from malicious software and accidental commands.
Safety Practices at the Command Line
- Verify the target before you act. Before running `diskpart` commands or `del /f /s`, confirm you have selected the correct disk or folder. A misidentified disk can wipe a colleague's data irreversibly.
- No lockout/tagout hazards apply to software commands, but always follow your organization's change-management policy before modifying disk partitions or system files on a production machine.
- Work in the lab environment only during class exercises. Never run diagnostic or configuration commands on a network segment you do not have authorization to touch.
- Document every command and its output in your lab log. This habit protects you professionally and helps you reproduce results.
Connecting to Exam Objectives
CompTIA A+ Core 2 tests your ability to use the command-line tools covered here in realistic scenarios: resolving IP conflicts, checking disk integrity, repairing system files, and gathering system information. Practice until you can recall syntax without notes and interpret output quickly — that skill transfers directly to the timed challenge and to the exam.
Key terms10
Elevated promptA Command Prompt or PowerShell window opened with Administrator privileges, required for commands that modify system files, disks, or security settings.
ipconfig /allA Command Prompt command that displays full IP configuration details for all network adapters, including MAC address, DHCP server, DNS servers, and lease dates.
sfc /scannowSystem File Checker command that scans protected Windows system files and automatically replaces corrupted or missing files from a cached copy; requires an elevated prompt.
diskpartAn interactive Windows command-line tool for managing disks, partitions, and volumes; capable of destructive operations such as deleting partitions, so target selection must be verified carefully.
cmdletA lightweight PowerShell command following Verb-Noun naming (for example, Get-Service); cmdlets return structured objects that can be piped to other cmdlets or exported to files.
Execution policyA PowerShell setting that controls whether and which scripts are allowed to run on a system; common values include Restricted, RemoteSigned, and Unrestricted.
tracertA Windows command-line tool that traces the path packets take to a destination host, displaying each router hop and the round-trip time, useful for diagnosing where a network failure occurs.
netstatA command-line utility that displays active network connections, listening ports, and associated protocol statistics; used to identify open ports and detect unexpected connections.
Least privilegeA security principle stating that users and processes should operate with only the minimum permissions needed for the task, reducing the risk of accidental or malicious damage.
chkdskCheck Disk: a Windows command that scans a volume for file-system errors and bad sectors; the /f switch fixes errors and /r locates bad sectors and recovers readable data.
In class: Guided command drill: students work through a printed command reference card, executing ipconfig /all, ping, tracert, netstat, sfc /scannow, chkdsk, diskpart, and dir in Command Prompt and recording output in their lab logs. · PowerShell scenario: instructor provides a script that creates a folder tree, sets permissions, and exports a system inventory to a text file; students run the script, verify output, and modify one variable to change the output folder. · Timed challenge: each student receives a list of five system tasks (e.g., display MAC address, check disk health, list running services) and must complete all five using only the command line in under 20 minutes.
Materials: Lab PCs running Windows 10/11, command reference card (instructor-prepared), PowerShell script file, lab log template, CompTIA A+ Core 2 Study Guide
Check: Timed challenge results reviewed by instructor: all five tasks completed correctly within 20 minutes; lab log commands and outputs present. Both criteria required to pass.
Practice check8
Answer each question, then check it. Nothing is recorded; this is your own practice.
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.