This chapter covers PowerShell basics for the CompTIA A+ 220-1102 exam, focusing on what you need to know as an IT support technician. PowerShell is Microsoft's task automation and configuration management framework, and it appears on the exam under Objective 1.2 (Operating Systems). While PowerShell questions are not a huge percentage of the exam (estimated 5-10%), they are often the ones that trip up candidates who have only used the GUI. This chapter will give you the foundational knowledge to understand PowerShell commands, interpret output, and perform basic administrative tasks from the command line.
Jump to a section
Think of PowerShell as a high-tech Swiss Army knife that doesn't just have blades and screwdrivers, but also a built-in computer that can remember what you did last week. Each command (cmdlet) is like a specific tool – one for cutting a file (Remove-Item), one for tightening a screw (Set-Service), one for measuring a distance (Get-ChildItem to see file sizes). But unlike a physical knife, PowerShell's tools can be combined. You can take the output of one tool (e.g., Get-Process) and pipe it into another (Stop-Process) to automatically stop any process that's using too much memory. The knife's computer (the PowerShell engine) uses a standard format for all tool outputs (objects) so you never have to worry about one tool producing text and another needing numbers. PowerShell also has a memory (the $profile script and session state) that remembers your favorite tool combinations as scripts. And just like a Swiss Army knife can be used for everything from opening a bottle to cutting a rope, PowerShell can manage files, services, registry, Active Directory, and even cloud resources. The key is that every tool follows the same verb-noun naming – Get, Set, Start, Stop – so you always know what a command does even if you've never used it before.
What is PowerShell and Why Does It Exist?
PowerShell is a command-line shell and scripting language built on the .NET framework. It was introduced by Microsoft in 2006 to address the limitations of the traditional Command Prompt (cmd.exe). Unlike cmd, which works with text output, PowerShell works with objects – structured data that can be manipulated programmatically. This object-oriented approach makes it far more powerful for automation because you can access properties and methods of objects directly, rather than parsing text strings.
For the 220-1102 exam, you need to know that PowerShell is pre-installed on modern Windows versions (Windows 7 SP1 and later, Windows Server 2008 R2 and later). The default version on Windows 10/11 is 5.1, though newer versions (PowerShell 7+) are available as separate installs. The exam focuses on PowerShell 5.1.
How PowerShell Works Internally
PowerShell commands are called cmdlets (pronounced 'command-lets'). Each cmdlet is a compiled .NET class that performs a single function. Cmdlets follow a Verb-Noun naming convention:
Verb: Get, Set, Start, Stop, New, Remove, etc.
Noun: Service, Process, Item, ChildItem, etc.
For example:
Get-Service: Retrieves the status of services.
Set-Service: Changes the startup type of a service.
Stop-Process: Terminates a running process.
When you run a cmdlet, the PowerShell pipeline (|) passes objects from one cmdlet to the next. Each object is an instance of a .NET class with properties (e.g., Name, Status, Size) and methods (e.g., Delete(), Start()). You can access these using dot notation: Get-Service | Where-Object {$_.Status -eq 'Running'}.
Key Components, Defaults, and Values
Cmdlet Naming: Always Verb-Noun. Common verbs: Get (retrieve), Set (change), New (create), Remove (delete), Start (begin), Stop (end), Restart (stop then start), Test (validate).
2. Aliases: Shortcuts for cmdlets. For example:
- dir is an alias for Get-ChildItem
- cls is an alias for Clear-Host
- gps is an alias for Get-Process
- sps is an alias for Stop-Process
- sc is an alias for Set-Content
- gc is an alias for Get-Content
Parameters: Modify cmdlet behavior. Parameters are prefixed with a dash (-). Examples:
- Get-Service -Name 'Spooler' - Get-ChildItem -Path C:\Windows -Recurse -Filter *.log
Pipeline: The | character passes output of one cmdlet as input to the next. Only cmdlets that accept pipeline input can receive objects this way.
5. Variables: Start with $. For example:
- $services = Get-Service
- $process = Get-Process -Name 'notepad'
6. Comparison Operators: Used in Where-Object and if statements: - -eq (equals) - -ne (not equal) - -gt (greater than) - -lt (less than) - -like (wildcard match, uses *) - -match (regex match)
Common Cmdlets for A+:
- Get-Help: Displays help about cmdlets. Example: Get-Help Get-Service -Examples
- Get-Command: Lists all available cmdlets. Example: Get-Command -Verb Get
- Get-Process: Lists running processes.
- Stop-Process: Stops a process by name or ID.
- Get-Service: Lists services and their status.
- Start-Service / Stop-Service / Restart-Service: Manage services.
- Get-ChildItem: Lists files and folders (like dir).
- Set-Location: Changes directory (like cd).
- Get-Content: Reads file content (like type).
- Set-Content: Writes content to a file.
- Clear-Host: Clears the screen.
PowerShell ISE: Integrated Scripting Environment – a GUI for writing, testing, and debugging scripts. Not on the exam heavily, but know it exists.
Configuration and Verification Commands
To verify PowerShell version:
$PSVersionTable.PSVersionThis outputs the major.minor.build.revision.
To get a list of all cmdlets:
Get-Command -CommandType CmdletTo get help for a specific cmdlet:
Get-Help Get-ProcessTo see examples:
Get-Help Get-Process -ExamplesTo update help files (requires admin):
Update-HelpHow PowerShell Interacts with Related Technologies
PowerShell can manage many Windows components that appear on the A+ exam:
- Services: Using Get-Service, Start-Service, etc.
- Processes: Using Get-Process, Stop-Process.
- Filesystem: Using Get-ChildItem, Remove-Item, Copy-Item, Move-Item.
- Registry: Using Get-ItemProperty, Set-ItemProperty (e.g., Get-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion').
- Event Logs: Using Get-EventLog (though deprecated, still tested) or Get-WinEvent.
- Network: Using Test-Connection (like ping), Get-NetIPAddress, Get-NetAdapter.
- Active Directory: Using ActiveDirectory module cmdlets like Get-ADUser (requires module installation).
PowerShell scripts (.ps1 files) can be run to automate tasks. Execution policy controls whether scripts run. Common policies:
Restricted: No scripts run (default on most Windows client OS).
AllSigned: Only scripts signed by a trusted publisher.
RemoteSigned: Downloaded scripts must be signed, local scripts can run unsigned.
Unrestricted: All scripts run.
To check execution policy:
Get-ExecutionPolicyTo change it (requires admin):
Set-ExecutionPolicy RemoteSignedCommon Exam Trap Patterns
Confusing cmdlets with cmd commands: The exam may show dir and ask what it does – it's an alias for Get-ChildItem, not the old cmd dir. But functionally they are similar.
Pipeline vs. parameter: Novices think you always need to use a pipe. But many cmdlets accept parameters directly. For example, Get-Service -Name 'Spooler' is simpler than Get-Service | Where-Object {$_.Name -eq 'Spooler'}.
Case sensitivity: PowerShell is case-insensitive by default, but some operators like -cmatch are case-sensitive. The exam may test that -eq is case-insensitive.
Execution policy blocking scripts: A common scenario: you write a script, it doesn't run, and you see an error about execution policy. The fix is to set it to RemoteSigned or Unrestricted.
Get-Process vs. Get-Service: Both list items, but one is for processes (running programs) and one for services (background system functions). Exam questions often mix them up.
Open PowerShell as Administrator
To perform many administrative tasks, you need to run PowerShell with elevated privileges. Right-click the Start button and select 'Windows PowerShell (Admin)' or 'Terminal (Admin)'. A UAC prompt will appear – click Yes. The PowerShell window opens with a title bar that says 'Administrator: Windows PowerShell'. The prompt typically shows 'PS C:\Windows\system32>' indicating you are in the system32 directory with admin rights. Without admin rights, cmdlets like Start-Service or Set-ExecutionPolicy will fail with permission errors.
Use Get-Help to Explore Commands
Before running unknown commands, use Get-Help to understand them. For example, type `Get-Help Get-Process`. The output shows the syntax, description, parameters, and examples. You can add `-Examples` to see practical usage. The help system in PowerShell 5.1 may need to be updated first with `Update-Help` (requires admin). If not updated, you may see a message that help is not available. The exam expects you to know that Get-Help is the primary way to learn about cmdlets.
Retrieve and Filter Process Information
Use `Get-Process` to list all running processes. To filter, you can use `Where-Object`. For example: `Get-Process | Where-Object {$_.WorkingSet -gt 100MB}` lists processes using more than 100 MB of memory. The `$_` represents the current object in the pipeline. The property `WorkingSet` is the memory usage in bytes. You can also filter by name: `Get-Process -Name 'notepad'`. If the process is not running, it returns an error. To avoid errors, use `-ErrorAction SilentlyContinue`.
Stop a Problematic Process
If a process is unresponsive, use `Stop-Process -Name 'notepad'` or `Stop-Process -Id 1234`. The -Id parameter uses the process ID (PID). You can find the PID from Get-Process output. For example: `Get-Process -Name 'notepad'` shows the PID in the Id column. To force stop a process, add `-Force`. Note that stopping critical system processes can cause instability. The exam may test that Stop-Process is the correct cmdlet to end a process, not End-Process or Kill-Process.
Manage Services with Start, Stop, Restart
Services are managed similarly to processes but with different cmdlets. `Get-Service` lists all services with Status (Running, Stopped, Paused) and StartType (Automatic, Manual, Disabled). To start a service: `Start-Service -Name 'Spooler'`. To stop: `Stop-Service -Name 'Spooler'`. To restart: `Restart-Service -Name 'Spooler'`. To change startup type: `Set-Service -Name 'Spooler' -StartupType Automatic`. These cmdlets require admin rights. The exam often asks which cmdlet changes service startup type – answer is Set-Service with -StartupType parameter.
Enterprise Scenario 1: Automated Cleanup of Old Log Files
A large enterprise runs hundreds of Windows servers generating log files daily. The IT team needs to delete log files older than 30 days from a specific directory to free up disk space. Using PowerShell, they write a script that uses Get-ChildItem to find files with a .log extension and then filters by LastWriteTime property using Where-Object. The filtered files are piped to Remove-Item. The script is saved as Cleanup.ps1 and scheduled to run weekly via Task Scheduler. The execution policy on servers is set to RemoteSigned to allow local scripts. A common issue is that the script fails if the directory path contains spaces – solved by enclosing the path in quotes. Another issue is that Remove-Item by default prompts for confirmation when deleting read-only files – adding -Force suppresses the prompt.
Enterprise Scenario 2: Bulk User Creation in Active Directory
When a company hires 50 new employees, the helpdesk must create user accounts in Active Directory. Using the ActiveDirectory module, they run a script that imports a CSV file with user details (Name, Username, Department, etc.) and uses New-ADUser to create each account. The script also sets the password and requires the user to change it at next logon. The script is tested in a lab environment first. A common misconfiguration is forgetting to import the ActiveDirectory module with Import-Module ActiveDirectory before running the script. Also, the script must be run from a domain controller or a machine with RSAT tools installed. The exam may ask which module is needed for AD user management – answer is ActiveDirectory.
Enterprise Scenario 3: Remote System Information Gathering
A managed service provider (MSP) monitors hundreds of client workstations. They use PowerShell remoting (Invoke-Command) to run Get-ComputerInfo on remote machines and collect hardware and OS details. The script outputs the data to a central CSV file for reporting. PowerShell remoting requires WinRM to be enabled and the proper firewall rules. A common issue is that remoting is blocked by Group Policy or firewall. The Test-WSMan cmdlet can verify connectivity. The exam may test that Invoke-Command is used for remote execution, not Enter-PSSession (which is interactive).
Exactly What 220-1102 Tests on PowerShell
The CompTIA A+ 220-1102 exam covers PowerShell under Objective 1.2 (Operating Systems) – specifically, 'Given a scenario, use the appropriate command-line tools.' The exam expects you to know the purpose of common cmdlets, how to interpret output, and how to perform basic tasks like stopping a process or restarting a service. You will NOT be asked to write complex scripts, but you should understand the pipeline and how to filter output.
Most Common Wrong Answers and Why
Using Command Prompt commands instead of PowerShell cmdlets: For example, a question asks 'Which PowerShell cmdlet stops a process?' A candidate might answer 'taskkill' because it works in cmd, but the correct answer is Stop-Process. The exam is testing your knowledge of PowerShell-specific tools.
Confusing Get-Process and Get-Service: A question might describe a service that is not running and ask which cmdlet to check. Novices might answer Get-Process, but services are checked with Get-Service.
Wrong execution policy name: Questions about execution policies often have 'Unrestricted' as a distractor. The default on Windows client is Restricted, not Unrestricted. Candidates may think Unrestricted is the default.
Pipeline misuse: A question might show Get-Process -Name 'notepad' | Stop-Process and ask if it will work. Some candidates think the pipe is unnecessary, but it works because Stop-Process accepts pipeline input. However, Stop-Process -Name 'notepad' is simpler.
Specific Numbers and Terms That Appear Verbatim
Default execution policy on Windows 10/11: Restricted
PowerShell version on Windows 10: 5.1
Common alias for Get-ChildItem: dir
Common alias for Stop-Process: sps or kill
Common alias for Get-Process: gps
Cmdlet to change service startup type: Set-Service with -StartupType parameter
Cmdlet to get help: Get-Help
Cmdlet to list commands: Get-Command
Edge Cases and Exceptions
Running scripts from a network share: Even with RemoteSigned policy, scripts from the Internet zone (including network shares) may be blocked. You need to unblock the file using Unblock-File or change the execution policy to Unrestricted.
64-bit vs. 32-bit PowerShell: On 64-bit Windows, there are two PowerShell shortcuts – Windows PowerShell (64-bit) and Windows PowerShell (x86). Some cmdlets may behave differently, especially when accessing registry keys like HKLM:\Software\Wow6432Node.
PowerShell ISE vs. Console: The ISE supports tab completion and syntax highlighting but may not be available on Server Core installations.
How to Eliminate Wrong Answers
When you see a PowerShell question, first identify the verb (Get, Set, Start, Stop, etc.) and the noun (Process, Service, Item, etc.). If the question asks to retrieve information, look for Get. If it asks to change something, look for Set. If it asks to end something, look for Stop. Eliminate any answer that uses a cmd verb that doesn't match (e.g., using Start to stop a process). Also, watch for cmd commands like 'net start' – those are not PowerShell cmdlets.
PowerShell cmdlets follow Verb-Noun naming: Get, Set, Start, Stop, New, Remove.
Common cmdlets for A+: Get-Process, Stop-Process, Get-Service, Start-Service, Stop-Service, Set-Service, Get-ChildItem, Get-Help, Get-Command.
Pipeline (|) passes objects between cmdlets; $_ represents the current object.
Default execution policy on Windows 10/11 is Restricted – scripts won't run until changed.
Set-ExecutionPolicy RemoteSigned allows local scripts to run; downloaded scripts must be signed.
Use Get-Help to learn about any cmdlet; add -Examples for practical usage.
Stop-Process ends a process; Stop-Service ends a service – they are not interchangeable.
PowerShell version on Windows 10 is 5.1; check with $PSVersionTable.PSVersion.
Aliases: dir (Get-ChildItem), cls (Clear-Host), gps (Get-Process), sps (Stop-Process).
To change service startup type: Set-Service -Name 'ServiceName' -StartupType Automatic/Manual/Disabled.
These come up on the exam all the time. Here's how to tell them apart.
Command Prompt (cmd.exe)
Output is plain text – requires parsing to extract values.
Commands are separate executables (e.g., ping, ipconfig).
No object pipeline – output must be redirected to files or other commands via text.
Limited scripting capabilities – no access to .NET classes.
Default on older Windows, still present but not the primary admin tool.
PowerShell
Output is objects – properties can be accessed directly.
Cmdlets are .NET classes following Verb-Noun naming.
Object pipeline allows passing structured data between cmdlets.
Full access to .NET framework – can create complex scripts and use classes.
Default on modern Windows – primary tool for automation and management.
Mistake
PowerShell is just a new version of Command Prompt.
Correct
PowerShell is a completely different shell built on .NET, not an upgrade to cmd.exe. It uses objects instead of text and has a different command syntax (Verb-Noun). While it can run legacy cmd commands, it is fundamentally different.
Mistake
You must use the pipeline for all cmdlets.
Correct
Many cmdlets accept parameters directly. For example, `Get-Service -Name 'Spooler'` works without piping. The pipeline is only needed when you want to pass objects from one cmdlet to another for filtering or further processing.
Mistake
The default execution policy allows running scripts.
Correct
The default execution policy on Windows client OS is Restricted, which prevents any scripts from running. You must change it to RemoteSigned or Unrestricted to run scripts.
Mistake
Get-Process and Get-Service are interchangeable.
Correct
Get-Process lists running programs (processes) with properties like CPU and memory. Get-Service lists Windows services (background system processes) with status and startup type. They manage different things.
Mistake
PowerShell commands are case-sensitive.
Correct
PowerShell is case-insensitive by default. For example, `Get-Process` and `get-process` both work. However, some operators like -cmatch and -cne are case-sensitive, but the exam rarely tests those.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
PowerShell is an object-oriented shell built on .NET, while Command Prompt (cmd.exe) is a text-based shell. PowerShell uses cmdlets (Verb-Noun) and outputs objects, making it easier to manipulate data. For example, `Get-Process` returns objects with properties like ProcessName and CPU, which can be filtered using Where-Object. In cmd, you'd use `tasklist` and parse text. PowerShell can also run cmd commands, but the reverse is not true.
Use the Set-ExecutionPolicy cmdlet. For example, to allow local scripts to run: `Set-ExecutionPolicy RemoteSigned`. You need to run PowerShell as Administrator. The available policies are Restricted, AllSigned, RemoteSigned, Unrestricted, Bypass, and Undefined. The default on Windows client is Restricted. Changing the policy requires administrative privileges and may trigger a UAC prompt.
The Stop-Service cmdlet stops a running service. For example: `Stop-Service -Name 'Spooler'`. You can also use the alias `spsv`. To start a service, use Start-Service; to restart, use Restart-Service. These cmdlets require admin rights. If the service is already stopped, you'll get an error – you can suppress it with `-ErrorAction SilentlyContinue`.
Use the Get-Process cmdlet. Simply type `Get-Process` to see all processes. To filter by name, use `-Name` parameter: `Get-Process -Name 'notepad'`. To filter by memory usage, use the pipeline: `Get-Process | Where-Object {$_.WorkingSet -gt 100MB}`. The alias for Get-Process is `gps`.
The pipeline (|) passes the output of one cmdlet as input to the next cmdlet. For example, `Get-Process | Stop-Process` would try to stop all processes (which is dangerous). More practically, `Get-Process | Where-Object {$_.CPU -gt 10}` filters processes with CPU usage over 10. The object output from the first cmdlet is sent to the second cmdlet's input. Not all cmdlets accept pipeline input.
Use the Get-Help cmdlet. For example, `Get-Help Get-Process` shows syntax, parameters, and description. Add `-Examples` to see usage examples: `Get-Help Get-Process -Examples`. If help is not installed, you may need to run `Update-Help` as administrator. Get-Help also works with aliases: `Get-Help dir`.
Windows 10 comes with Windows PowerShell 5.1 pre-installed. You can check the version by running `$PSVersionTable.PSVersion`. This outputs a table with Major, Minor, Build, and Revision. PowerShell 7 (Core) is a separate cross-platform version that can be installed alongside, but the default for A+ is 5.1.
You've just covered PowerShell Basics for A+ — now see how well it sticks with free 220-1102 practice questions. Full explanations included, no account needed.
Done with this chapter?