CompTIA A+ Core 2 (220-1202) · chapter 17 of 17
Ops: Scripts and remote access
In this chapter Objectives 4.8, 4.9
Objective 4.8
Scripting basics
Script file types
Recognize the language by the extension:
Ext Language Typical home
.bat Batch file Windows cmd.exe
.ps1 PowerShell Windows admin (also
PowerShell 7 on
macOS and Linux)
.vbs VBScript legacy Windows
.sh Shell (bash) Linux and macOS
.js JavaScript web pages, Node.js,
Windows Script Host
.py Python cross-platformExam tip Windows admin automation today = .ps1. Linux/macOS = .sh. Cross-platform general purpose = .py.
Use cases for scripting
Scripts do repetitive work the same way every time:
- Basic automation of routine tasks
- Restarting machines on a schedule
- Remapping network drives after a server move
- Installation of applications silently on many PCs
- Automated backups (copy jobs on a schedule)
- Gathering of information/data: inventory, disk space, installed software
- Initiating updates across many systems
A sample script
A PowerShell script to remap S: after the server move:
# remap-s.ps1
$old = Get-PSDrive S -EA SilentlyContinue
if ($old) { Remove-PSDrive S -Force }
New-PSDrive -Name S `
-PSProvider FileSystem `
-Root \\fs02\shipping -Persist
Write-Output "$env:COMPUTERNAME S: -> fs02"Exam tip PowerShell's execution policy can block unsigned scripts. Sign company scripts instead of turning protection off.
Other considerations when using scripts
Scripts multiply mistakes as fast as they multiply work:
- Unintentionally introducing malware: copied scripts from forums or AI can hide malicious code; review every line and use trusted sources
- Inadvertently changing system settings: one wrong line runs on every PC; test in a sandbox and on a small pilot group first
- Browser or system crashes due to mishandling of resources: loops that never end, memory that's never released, too many processes at once
Exam tip Test on one PC, then a pilot group, then everyone, with a rollback ready. Same idea as change management.
Check yourself 1A Linux admin wants a script that compresses the label logs every night on the warehouse Ubuntu PC using the default shell. Which file type fits best?
- .bat
- .sh
- .vbs
- .ps1
Show the answer
Answer: B. .sh
Shell scripts (.sh) run natively in bash on Linux and macOS, so they're the natural choice for a nightly job on Ubuntu.
Objective 4.9
Remote access technologies
Methods and tools
Ways to reach a computer you're not sitting at:
- RDP (Remote Desktop Protocol, TCP 3389): full Windows desktop; host must be Pro or higher
- VPN: encrypted tunnel into the company network; then use other tools inside it
- VNC (Virtual Network Computing): screen sharing across platforms; often weak encryption on its own
- SSH (Secure Shell, TCP 22): encrypted command line, mainly Linux, macOS and network gear
- WinRM (Windows Remote Management): runs PowerShell commands remotely, no desktop needed
- SPICE: remote display protocol for virtual machines (e.g. KVM/QEMU)
- RMM (remote monitoring and management): agents on every PC for monitoring, patching and scripts at scale, used by IT teams and MSPs
Third-party tools
Beyond built-in protocols, third-party tools fill four roles:
- Screen-sharing software: view or control a user's screen with their consent
- Videoconferencing software: meetings with screen sharing and remote control
- File transfer software: move files securely (SFTP, managed transfer)
- Desktop management software: inventory, software deployment and remote control for a whole fleet
Exam tip Scammers love remote-control tools. Users should only accept sessions they requested from known IT staff.
Security considerations of each method
Every remote door needs a lock:
Method Main risk Mitigation
RDP open 3389, VPN/gateway,
brute force MFA, NLA
VPN stolen creds MFA, patch it
VNC weak/no crypto tunnel in SSH/VPN
SSH password guessing keys, no root
WinRM lateral movement HTTPS 5986,
limit admins
RMM one breach = all MFA, vet vendor
3rd-pty scam "support" approved toolsExam tip Never expose RDP directly to the internet. Put it behind a VPN or RD Gateway with MFA.
Practice questions
Answer in your head, then open the answer. Ranger's Help Desk has 444 questions like these for A+ Core 2, with mock exams.
Question 1A Windows administrator writes a script that uses cmdlets like Get-Service and Restart-Computer. Which file extension should it have?
- .vbs
- .sh
- .ps1
- .bat
Show the answer
Answer: C. .ps1
PowerShell scripts use the .ps1 extension and run cmdlets such as Get-Service.
Question 2A Linux administrator wants to automate nightly log cleanup with a script run by cron. Which file type is MOST commonly used?
- .ps1
- .sh
- .vbs
- .bat
Show the answer
Answer: B. .sh
.sh files are shell scripts run by a Linux or macOS shell such as Bash, and cron commonly runs them on a schedule.
Question 3An office still uses a short logon script with 'net use S: \\fs01\shared' to map a drive on older Windows PCs. Which file type is this script MOST likely to be?
- .js
- .py
- .sh
- .bat
Show the answer
Answer: D. .bat
net use is a command-prompt command, and simple logon scripts that remap network drives are commonly written as .bat batch files.
Question 4A technician wants one script that gathers disk space and OS details from Windows, macOS, and Linux machines. He plans to install an interpreter on each. Which script type fits BEST?
- .bat
- .vbs
- .py
- .sh
Show the answer
Answer: C. .py
Python (.py) scripts run on many operating systems once the Python interpreter is installed, which suits a cross-platform task.
Question 5A user receives an email attachment named Invoice_8841.js. When opened on Windows, which risk does this create?
- It cannot run without the Python interpreter
- It can run as a script and install malware
- It will only open in a browser as a web page
- It is a text file and cannot run any code
Show the answer
Answer: B. It can run as a script and install malware
On Windows, a .js file can be run directly by Windows Script Host, so a malicious one can download and install malware. This is a common attack method.
CompTIA, A+, Network+, Security+ and Linux+ are trademarks of CompTIA, Inc. Ranger Gamez is not affiliated with or endorsed by CompTIA. The practice questions are written to the published exam objectives; they are not real exam questions.