What you will learn
- The six script file types and where each one runs
- Common uses: automation, restarts, drive mapping, installs, backups, inventory, updates
- How scripts can introduce malware or change settings by mistake
- How mishandled resources crash browsers and systems
- What to check before running any script
PRACTICE TESTS
Ready to drill it?
Practice tests for CompTIA A+ Core 1 and Core 2, every answer explained and checked against published sources. $19.95 for 30 days, plus sales tax where it applies; one payment, nothing renews.
See the 30-day passChapters
Exam objectives covered
- Core 2 (220-1202) objective 4.8, Operational Procedures
Transcript
Read the full lesson narration
Script file types
A script is a text file full of commands that the computer runs for you. Write it once, and a job that took an hour takes seconds, on one machine, or on a thousand.
Start with the file types. A .bat file is a Windows batch file, run by the Command Prompt. A .ps1 file is PowerShell, the modern Windows scripting language. A .vbs file is VBScript, an older Windows language that Microsoft is phasing out. A .sh file is a shell script for Linux and macOS. A .js file is JavaScript, used in web pages, with tools like Node, and by Windows Script Host. And a .py file is Python, which runs on almost any system that has it installed.
What scripts are used for
Scripts shine at repetitive work. Basic automation, like restarting machines overnight, or remapping network drives when users sign in. Installing applications on many computers at once. Running automated backups. Gathering information, like an inventory of every computer's hardware. And initiating updates on a schedule.
Script risks
Scripts are powerful, so they can do damage. A script from an untrusted source can introduce malware. A script with a mistake can change system settings you never meant to touch, or delete the wrong files. And a script that mishandles resources, like a loop that never ends, or one that keeps using more memory, can crash a browser, or the whole system.
Before a script runs
So before any script runs, check four things: where it came from, what it's meant to do, exactly what it will touch, and that it's approved. Read it before you run it, and try it on a test machine first. A familiar file extension, or an urgent request, doesn't make a script safe.
Quick drill and recap
Drill time. Say the answer before I do. Which file extension is a PowerShell script? .ps1. A script must run on a Linux server. Which extension does it use? .sh. Every user needs the same network drive mapped at sign-in. How can a script do it? With a logon script. A coworker emails you a script that urgently fixes printing. What do you check first? Its source, and its approval. A script's loop never ends, and memory keeps climbing. What can happen? The system can crash.
Lock in these four. One. Types: .bat, .ps1, .vbs, .sh, .js, and .py. Two. Uses: automation, restarts, drive mapping, installs, backups, inventory, and updates. Three. Risks: malware, changed settings, and crashes. Four. Before it runs: the source, the purpose, the target, and approval.
That's scripting basics. Now go prove it. Practice questions are waiting for you in Drill Sergeant.
PRACTICE TESTS
Ready to drill it?
Practice tests for CompTIA A+ Core 1 and Core 2, every answer explained and checked against published sources. $19.95 for 30 days, plus sales tax where it applies; one payment, nothing renews.
See the 30-day passRelated lessons
Found a mistake in a lesson? Email support@drillsgthq.com with the lesson and what is wrong.
Drill Sergeant is an independent study resource. It is not affiliated with, endorsed by, or sponsored by CompTIA, Inc. CompTIA and A+ are trademarks or registered trademarks of CompTIA, Inc.