Free Basics of Scripting practice questions
10 free 220-1202 questions on Basics of Scripting, each with a full explanation — no account needed. This section sits in the Operational Procedures part of the exam. Answer every question to see your score, then read the lessons below for anything you missed.
A technician receives an email attachment with a file that ends in the .ps1 extension. Which interpreter is responsible for executing this type of file?
A .ps1 file is a Windows PowerShell script, so it is executed by Windows PowerShell (or PowerShell Core on other platforms). PowerShell is Microsoft's modern automation framework built on the .NET platform and uses cmdlets that follow a verb-noun pattern such as Get-Process or Stop-Service. Command Prompt (cmd.exe) runs batch files with the .bat or .cmd extension and passes plain text between commands rather than objects. Windows Script Host runs .vbs VBScript files and .js JavaScript files when double-clicked on Windows, using wscript.exe or cscript.exe. The Bash shell executes .sh shell scripts on Linux, Unix, and macOS systems, typically beginning with a shebang line. Recognizing the .ps1 extension correctly tells a technician which interpreter will run the code, what platform it belongs to, and helps them judge whether the file is safe and appropriate for the machine in front of them.
A user on a Linux server needs to automate a nightly cleanup task. Which file type and interpreter combination is the native choice for this environment?
A .sh shell script executed by Bash (Bourne Again Shell) is the native way to automate tasks on Linux, Unix, and macOS. Shell scripts usually begin with a shebang line such as #!/bin/bash and require the execute permission to be set with a command like chmod +x before they can run. A .bat file run by cmd.exe is a Windows batch file and will not execute natively on a Linux server. A .ps1 file run by PowerShell is Microsoft's Windows administration language; while PowerShell Core is cross-platform, it is not the native or default choice for a standard Linux server task. A .vbs file run by Windows Script Host is legacy Windows-only technology and cannot run on Linux at all. Shell scripting is a core Linux administration skill and appears throughout server management, cron jobs, and system startup routines, making the .sh with Bash combination the correct fit for this scenario.
A technician wants to deploy a standard software package silently to hundreds of Windows machines using a Windows MSI installer. Which command should be used in the deployment script?
The command msiexec /i app.msi /quiet /norestart installs a Windows MSI package silently without rebooting, which is exactly what is needed to deploy software uniformly to many machines without a technician clicking through a wizard on each one. The /quiet switch suppresses the user interface and /norestart prevents an automatic reboot. The command sudo apt install -y app installs applications on Debian/Ubuntu Linux, not Windows, so it is inappropriate for MSI deployment. The command robocopy C:\app D:\app /mir is a robust file copy and mirroring tool used for backups, not for installing applications. The command net use A: \\server\app /persistent:yes maps a network drive to a drive letter, which is a drive-remapping task rather than software installation. Silent installation switches are central to rolling out a standard software set across a fleet, allowing one technician to provision hundreds of machines identically.
A technician downloads a script from an unfamiliar forum that claims to fix a common Windows issue. Before running it, what is the MOST important safe-handling practice to follow?
The single most important safeguard is to review a script before running it. Because scripts are readable plain text, a technician can open one in a text editor and examine exactly what it does, looking for commands that delete files, modify the Registry, change permissions, disable security tools, or reach out to the internet. If any line is not understood or points at the wrong target, the script should not be run. Running the script as administrator does the opposite of what is safe; it grants the script broad power and increases the blast radius if the code is malicious or buggy, violating the principle of least privilege. Disabling the PowerShell execution policy removes a protective restriction that exists specifically to prevent unsigned scripts from running, so it should be left restrictive rather than turned off for convenience. Renaming the file extension does nothing to make untrusted code safe and may simply change which interpreter runs it. Reviewing the code and confirming a trusted source is the foundation of safe scripting.
A technician needs to restart a remote Windows workstation named PC-102 immediately after applying a driver update. Which command accomplishes this?
The command shutdown /r /m \\PC-102 /t 0 restarts a remote machine named PC-102 immediately. The /r switch specifies a restart, the /m switch targets a remote machine by name, and /t 0 sets a zero-second delay so the reboot happens right away. The command sudo reboot PC-102 is a Linux command and will not work on a Windows workstation. The command net use \\PC-102 /restart is invalid because net use is for mapping network drives, not restarting machines. The command shutdown /s /m \\PC-102 /t 60 uses the /s switch, which performs a full shutdown rather than a restart, and adds a 60-second delay, so it does neither what is requested nor immediately. A scripted restart after an update or driver install saves the technician from touching each device by hand, and knowing the correct switches ensures the intended action occurs.
A company is concerned about running a vendor-supplied deployment script on their entire fleet of computers. Which practice BEST contains the potential damage if the script contains a hidden flaw?
Testing a new or modified script on a single lab machine, a virtual machine, or a non-critical test system first is the practice that reveals typos, wrong paths, runaway loops, and resource problems before they can reach real users and important data. A mistake in a safe test environment harms nothing that matters, and rolling out gradually proves the script on one machine before pushing it to many. Scheduling the script to run during off-hours only changes when a flawed script executes but does nothing to catch the flaw itself; a bad script running overnight can still damage the entire fleet. Converting the script to a compiled binary does not remove logic errors or malicious commands and is not a standard safe-handling practice for scripts. Running the script twice simply repeats any harmful action a second time and confirms nothing about its safety. Testing first, combined with keeping a backup of anything the script will change, turns 'I think this works' into 'I've seen this work.'
A technician wants to capture the full network configuration of a Windows machine and save it to a text file for an inventory audit. Which command achieves this?
The command ipconfig /all > netinfo.txt saves the full network configuration to a file. The > symbol redirects the output of the command into a file instead of displaying it on screen, which is exactly how technicians build centralized data sets for inventories and audits. The command ipconfig /all | del netinfo.txt is invalid because the pipe would attempt to send output to the del command, which deletes files rather than accepting piped input. The command net use /all netinfo.txt is incorrect because net use manages network drive mappings and does not gather or redirect system information. The command systeminfo /save netinfo.txt uses a switch that does not exist for systeminfo; while systeminfo does report OS, hardware, and patch information, saving its output to a file would require redirection with the > symbol. Gathering information and data with scripts is invaluable for asset inventories, allowing a technician to query many machines and redirect the results to files rather than visiting each system manually.
A user reports that a web page keeps freezing and eventually crashes the entire browser after a few seconds. A technician suspects a script on the page is at fault. Which cause is MOST likely responsible?
Scripts can cause browser or system crashes and slowdowns by mishandling resources, and a common culprit is an infinite loop or a routine that keeps allocating memory without a stopping condition. A browser-based JavaScript function that grows an array or triggers itself repeatedly will keep consuming memory until the tab or the whole browser becomes unresponsive, producing exactly the freeze-then-crash symptom described. A script using the least privilege principle is a safe-handling practice that limits permissions and would not cause a crash. A script that was reviewed before it was run has been examined for dangerous commands, making harmful behavior less likely rather than the cause. A script signed by a trusted certificate authority indicates it comes from a verified source, which addresses trust and malware concerns, not resource exhaustion. The lesson is that scripts must be written to use resources deliberately, with clear stopping conditions and reasonable limits, and tested to confirm they release what they consume.
A technician finds an unexpected .vbs file attached to an email from an unknown sender. Which statement BEST explains why this should raise immediate suspicion?
A .vbs VBScript file runs automatically inside the Windows Script Host when double-clicked and can perform powerful actions, which is why they have historically been a favorite vehicle for malware. An unexpected .vbs attachment from an unknown sender should always raise suspicion because running it could silently install ransomware, create backdoor accounts, or spread across a network the moment it executes. The claim that VBScript files can only run on Linux systems is false; VBScript is legacy Windows technology that has been deprecated by Microsoft and does not run on Linux. The claim that VBScript files require a compiler is incorrect because scripts are interpreted plain-text files executed line by line, not compiled to a binary ahead of time. The claim that VBScript files cannot modify system settings is also false; VBScript can perform powerful actions including changing settings, which is precisely what makes malicious versions dangerous. The rule is to never run a script from an untrusted source and to be especially wary of unexpected script attachments.
A technician is setting up an automated nightly backup on a Windows server that mirrors a data folder to a backup drive. Which combination of tools is the standard approach?
On Windows, robocopy is the standard robust copy tool for backups, and a command such as robocopy C:\Data D:\Backup /mir mirrors the source folder to the backup drive, keeping them identical. Task Scheduler is the Windows service that launches scripts on a fixed schedule with no human involvement, making robocopy launched by Task Scheduler the correct approach for a scheduled nightly Windows backup. The combination of rsync launched by cron is the Linux equivalent; rsync is the Linux robust copy tool and cron is the Linux scheduler, so neither belongs on a Windows server. The combination of net use launched by Windows Script Host is incorrect because net use maps network drives rather than copying files for backup. The combination of msiexec launched by Group Policy relates to installing MSI application packages, not backing up data. A scheduled backup script is the difference between 'we have backups' and 'we thought we had backups,' and choosing the correct platform-appropriate tools ensures reliability.
Study this section
Every lesson that covers Basics of Scripting on the 220-1202 exam.