CompTIA A+ guideCore 2 skills
Scripting on A+ Core 2: What You Need to Know (and What You Don't)
Objective 4.8 asks you to recognize six script types, match them to support tasks, and know the risks. Here is each type with a short, harmless example to read.
Short answer
Objective 4.8 asks you to explain scripting basics, not to write programs. You need to recognize six file types (.bat, .ps1, .vbs, .sh, .js, .py), match scripts to support jobs such as automation, restarting machines, remapping network drives, installing applications, automated backups, gathering information, and starting updates, and know the risks CompTIA lists: unintentionally introducing malware, changing system settings by accident, and crashes from mishandled resources. Being able to read a short script and say what it does is the practical bar.
What objective 4.8 actually lists
Scripting sits in Operational Procedures, the smallest Core 2 domain at 21%. The objective's verb is "explain," and its bullets are three short lists: script file types, use cases, and other considerations. There is no list of programming constructs. CompTIA notes that its bulleted examples are not exhaustive, so being able to read a comment, a variable, and a simple command sequence is a sensible margin. Writing a program from scratch is not what this objective describes.
Six file types, and how to recognize each one
| Extension | Language and where it runs | Recognition clues |
|---|---|---|
.bat | Windows batch file, run by the Command Prompt (cmd.exe) | @echo off, REM comments, variables like %USERNAME%, ordinary commands such as ipconfig |
.ps1 | PowerShell script | Verb-Noun commands such as Get-Service, variables that start with $, # comments |
.vbs | VBScript, run by Windows Script Host | Set, CreateObject(...), WScript.Echo, ' comments |
.sh | Shell script for Linux and macOS | A first line like #!/bin/bash, # comments, Linux commands such as df |
.js | JavaScript, run in a browser, in Node.js, or by Windows Script Host on Windows | // comments, console.log, curly braces and semicolons |
.py | Python, which needs a Python interpreter installed | import, print(...), indentation that defines blocks, # comments |
Two current facts change how these behave on Windows:
- PowerShell execution policy. On a Windows client where no policy has been set, Windows PowerShell's effective policy is Restricted, which "permits individual commands, but doesn't allow scripts." Windows Server defaults to RemoteSigned. Microsoft is explicit that the execution policy "isn't a security boundary," so it does not replace judgment about what a script does.
- VBScript is deprecated. Microsoft announced the deprecation in October 2023 and says VBScript will be available as a feature on demand before it is removed from Windows. Old logon scripts written in VBScript are a migration task, not a pattern for new work.
Read these, don't memorize them
Each example is short, read-only, and safe to run on your own machine. The point is recognition: name the language and say in one sentence what the script does.
Batch (.bat)
@echo off
REM Show who is signed in and this PC's network settings
whoami
hostname
ipconfig /all
PowerShell (.ps1)
<# List services that are stopped right now #>
Get-Service | Where-Object Status -eq 'Stopped'
VBScript (.vbs)
' Show this computer's name
Set objNetwork = CreateObject("WScript.Network")
WScript.Echo objNetwork.ComputerName
Shell (.sh)
#!/bin/bash
du -sh "$HOME" # space used in the home folder
df -h # free space on each filesystem
JavaScript (.js), in a browser console or Node.js
// Print today's date
console.log(new Date().toDateString());
Python (.py)
"""Show the PC's network name and Python version."""
import platform
print(platform.node())
print(platform.python_version())
Match the script to the support job
| Use case in 4.8 | A realistic example | Likely file type |
|---|---|---|
| Basic automation | Clear a temp folder on many PCs every Friday | .ps1 on Windows, .sh on Linux |
| Restarting machines | Reboot lab computers after hours | .ps1 or .bat on Windows |
| Remapping network drives | Map S: to the team share at sign-in, for example with net use | .bat or .ps1, often assigned as a logon script |
| Installation of applications | Push the same app version to twenty new laptops | .ps1 |
| Automated backups | Copy Documents to a backup drive each night with robocopy | .bat or .ps1 |
| Gathering of information | Collect OS version and free disk space for an inventory | .ps1, .sh, or .py |
| Initiating updates | Run package updates on a Linux workstation, for example with apt | .sh |
Core 2 objective 2.2 also lists "assigning log-in script" as an Active Directory task, which is the domain version of the drive-mapping row.
The risks CompTIA lists, as five checks before you run anything
The 4.8 considerations are unintentionally introducing malware, inadvertently changing system settings, and browser or system crashes from mishandled resources. Turn them into checks:
- Where did it come from? A script from a forum, an email, or an AI chat is untrusted until you have read every line.
- What does it change? Look for commands that delete, overwrite, change the registry, change services, or change permissions. A misplaced path in a delete command is how a cleanup script empties the wrong folder.
- Does it mirror or purge? Microsoft's robocopy reference says
/mirmirrors a tree and is equivalent to/eplus/purge, which "deletes destination files and directories that no longer exist in the source." Point a mirror at the wrong destination and it deletes files. Robocopy's/loption lists what would happen without copying or deleting anything, which makes it a safe dry run. - Does it download and run something else? A script that fetches code from the internet and executes it inherits every risk of that code.
- Does it loop or grow without limit? A loop with no exit, or a log file that grows forever, is how a "simple" script crashes a browser or fills a disk.
Then test it on one machine or in a virtual machine before you run it on many. That is also what change management expects, as the operational procedures guide explains.
What you can safely skip
You do not need to memorize PowerShell parameters, write functions, or debug Python. You do need to know which interpreter runs which file, why a .sh script needs execute permission on Linux (see the chmod section of the macOS and Linux guide), and why a script that runs as administrator deserves more scrutiny than one that runs as a standard user. Many of the commands inside these scripts are the ones in the Windows command line guide.
Cover the file names above each example and name the language from the code alone, then keep practicing the Core 2 domain that includes scripting with Passy.
Trust the source
Official sources
Exam policies can change. Use these primary sources for the most current details.