0
0
PowerShellscripting~20 mins

Why PowerShell exists - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
PowerShell Automation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Purpose of PowerShell
Why was PowerShell created as a scripting and automation tool?
ATo replace all graphical user interfaces with text-based commands only.
BTo act as a web development framework for creating websites.
CTo serve as a programming language for building mobile applications.
DTo provide a command-line shell and scripting language that integrates with Windows and supports automation of system tasks.
Attempts:
2 left
💡 Hint
Think about what tasks system administrators need to automate on Windows.
🧠 Conceptual
intermediate
2:00remaining
PowerShell vs Traditional Shells
What is a key reason PowerShell was developed instead of just using traditional shells like CMD or Bash?
APowerShell was created to only run on Linux systems.
BPowerShell is designed only for web developers.
CPowerShell uses objects instead of plain text, making it easier to manipulate complex data.
DPowerShell removes the need for any scripting by automating everything automatically.
Attempts:
2 left
💡 Hint
Think about how data is passed between commands in PowerShell compared to older shells.
💻 Command Output
advanced
2:00remaining
PowerShell Command Output Format
What is the output of this PowerShell command? Get-Process | Select-Object -First 1 | Get-Member -MemberType Property | Select-Object -First 3 -ExpandProperty Name
PowerShell
Get-Process | Select-Object -First 1 | Get-Member -MemberType Property | Select-Object -First 3 -ExpandProperty Name
A
BasePriority
EnableRaisingEvents
ExitCode
B
ProcessName
Id
CPU
C
Name
Id
Handles
D
Id
CPU
ProcessName
Attempts:
2 left
💡 Hint
Get-Member lists properties alphabetically by default.
🔧 Debug
advanced
2:00remaining
Identify the Error in PowerShell Script
What error will this PowerShell script produce? $services = Get-Service | Where-Object Status -eq 'Running' $services | ForEach-Object { $_.Name }
PowerShell
$services = Get-Service | Where-Object Status -eq 'Running'
$services | ForEach-Object { $_.Name }
ARuntimeError: Property 'Name' does not exist
BSyntaxError: Missing script block for Where-Object
CNo error; outputs names of running services
DTypeError: Cannot pipe objects to ForEach-Object
Attempts:
2 left
💡 Hint
Check the syntax of the Where-Object command.
🚀 Application
expert
3:00remaining
Automating File Backup with PowerShell
Which PowerShell script correctly copies all .txt files from C:\Data to D:\Backup, creating the destination folder if it doesn't exist?
Aif (-not (Test-Path 'D:\Backup')) { New-Item -ItemType Directory -Path 'D:\Backup' } Copy-Item -Path 'C:\Data\*.txt' -Destination 'D:\Backup'
BCopy-Item -Path 'C:\Data\*.txt' -Destination 'D:\Backup' -Force -Recurse
CNew-Item -ItemType Directory -Path 'D:\Backup' Copy-Item 'C:\Data\*.txt' 'D:\Backup'
DCopy-Item -Path 'C:\Data\*.txt' -Destination 'D:\Backup' -Recurse
Attempts:
2 left
💡 Hint
Check if the destination folder exists before copying files.