Bird
Raised Fist0
PowerShellscripting~20 mins

Why PowerShell automates admin tasks - Challenge Your Understanding

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
PowerShell Automation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this PowerShell command?
Consider the following PowerShell command that lists services and filters only those that are running. What will be the output?
PowerShell
Get-Service | Where-Object { $_.Status -eq 'Running' } | Select-Object -First 3 -Property Name, Status
AList of all services regardless of status
B[{Name: 'Audiosrv', Status: 'Running'}, {Name: 'Dhcp', Status: 'Running'}, {Name: 'Dnscache', Status: 'Running'}]
CError: 'Where-Object' is not recognized
DEmpty list because no services are running
Attempts:
2 left
💡 Hint
Think about how the command filters services by their status and selects only the first three.
🧠 Conceptual
intermediate
1:30remaining
Why is PowerShell preferred for automating admin tasks?
Which of the following reasons best explains why PowerShell is widely used to automate administrative tasks?
AIt uses a simple text-based scripting language that can interact with system components and supports objects.
BIt only works on Windows and cannot access system settings.
CIt requires complex graphical interfaces to run scripts.
DIt cannot automate tasks and is only for manual commands.
Attempts:
2 left
💡 Hint
Think about how PowerShell handles data and system control.
🔧 Debug
advanced
2:00remaining
Identify the error in this PowerShell script
This script is intended to stop all running services whose names start with 'A'. Which of the following is true?
PowerShell
Get-Service A* | Where-Object { $_.Status -eq 'Running' } | Stop-Service
AError: 'Get-Service' does not accept wildcards directly.
BError: 'Where-Object' is misspelled causing a command not found.
CError: 'Stop-Service' requires confirmation and will fail silently.
DNo error; script stops all running services starting with 'A'.
Attempts:
2 left
💡 Hint
Check if 'Get-Service' supports wildcards in its parameters.
🚀 Application
advanced
2:30remaining
How to automate user account creation with PowerShell?
You want to create multiple user accounts in Active Directory using PowerShell. Which approach below correctly automates this task?
AUse a CSV file with user details and a script that reads the file and runs New-ADUser for each entry.
BWrite a script that only prints user names without creating accounts.
CManually open Active Directory Users and Computers and create each user one by one.
DUse PowerShell to delete existing users instead of creating new ones.
Attempts:
2 left
💡 Hint
Think about how to handle multiple users efficiently with PowerShell.
📝 Syntax
expert
3:00remaining
Which PowerShell snippet correctly outputs the names of running services in alphabetical order?
Select the snippet that lists only running services and sorts their names alphabetically.
AGet-Service | Where-Object { $_.Status = 'Running' } | Sort-Object Name | Select-Object Name
BGet-Service | Sort-Object Status | Where-Object { $_.Status -eq 'Running' } | Select-Object Name
CGet-Service | Where-Object { $_.Status -eq 'Running' } | Sort-Object Name | Select-Object -Property Name
DGet-Service | Select-Object Name | Where-Object { $_.Status -eq 'Running' } | Sort-Object Name
Attempts:
2 left
💡 Hint
Remember the correct operator for comparison and the order of filtering and sorting.

Practice

(1/5)
1. Why do system administrators use PowerShell to automate tasks?
easy
A. Because it requires no learning
B. Because it only works on one computer
C. To make computers slower
D. To save time and reduce manual errors

Solution

  1. Step 1: Understand the purpose of automation

    Automation helps reduce repetitive manual work and mistakes.
  2. Step 2: Identify PowerShell benefits

    PowerShell automates tasks to save time and reduce errors, making admin work easier.
  3. Final Answer:

    To save time and reduce manual errors -> Option D
  4. Quick Check:

    Automation = Save time and reduce errors [OK]
Hint: Automation saves time and avoids mistakes [OK]
Common Mistakes:
  • Thinking automation makes computers slower
  • Believing PowerShell requires no learning
  • Assuming it only works on one computer
2. Which of the following is the correct way to run a PowerShell cmdlet to list files in a folder?
easy
A. Get-ChildItem
B. List-Files
C. Show-Folder
D. GetFiles

Solution

  1. Step 1: Recall common PowerShell cmdlets

    PowerShell uses cmdlets like Get-ChildItem to list files and folders.
  2. Step 2: Identify the correct cmdlet

    Get-ChildItem is the standard cmdlet to list directory contents.
  3. Final Answer:

    Get-ChildItem -> Option A
  4. Quick Check:

    List files cmdlet = Get-ChildItem [OK]
Hint: Remember cmdlets use Verb-Noun format [OK]
Common Mistakes:
  • Using non-existent cmdlets like List-Files
  • Confusing cmdlet names with other commands
  • Omitting the dash between verb and noun
3. What will this PowerShell script output?
1..3 | ForEach-Object { "Task $_ completed" }
medium
A. 1 2 3
B. Task $_ completed
C. Task 1 completed Task 2 completed Task 3 completed
D. Error: $_ not defined

Solution

  1. Step 1: Understand the range operator and pipeline

    1..3 creates numbers 1, 2, 3 and pipes them one by one.
  2. Step 2: Evaluate ForEach-Object with string interpolation

    For each number, it outputs "Task <number> completed" using $_ as current item.
  3. Final Answer:

    Task 1 completed Task 2 completed Task 3 completed -> Option C
  4. Quick Check:

    Loop with $_ outputs tasks 1 to 3 [OK]
Hint: $_ holds current item in pipeline loops [OK]
Common Mistakes:
  • Thinking $_ is undefined outside loops
  • Expecting numbers only without text
  • Confusing output as a single string without spaces
4. Identify the error in this PowerShell script:
Get-Process | Where-Object { $_.Name -eq 'notepad' }
medium
A. Missing closing brace '}'
B. No error, script is correct
C. Incorrect operator '-eq'
D. Wrong cmdlet name 'Get-Process'

Solution

  1. Step 1: Check syntax of Where-Object filter

    The script uses correct syntax with braces and -eq operator to filter processes.
  2. Step 2: Verify cmdlet names and operators

    Get-Process and Where-Object are valid cmdlets; -eq is correct for equality check.
  3. Final Answer:

    No error, script is correct -> Option B
  4. Quick Check:

    Script syntax and cmdlets are valid [OK]
Hint: Check braces and cmdlet names carefully [OK]
Common Mistakes:
  • Assuming missing brace when it is present
  • Confusing -eq with other operators
  • Thinking cmdlet names are case-sensitive
5. You want to automate restarting a service on multiple computers using PowerShell. Which approach best achieves this?
hard
A. Write a script using Invoke-Command to run Restart-Service remotely on each computer
B. Manually log into each computer and restart the service
C. Use Get-Process to find the service and kill it
D. Run Restart-Service locally without specifying computers

Solution

  1. Step 1: Understand remote automation with PowerShell

    Invoke-Command runs commands on remote computers, ideal for multi-computer tasks.
  2. Step 2: Identify correct cmdlet for restarting services remotely

    Restart-Service restarts a service; combined with Invoke-Command it runs remotely on each target.
  3. Final Answer:

    Write a script using Invoke-Command to run Restart-Service remotely on each computer -> Option A
  4. Quick Check:

    Remote automation uses Invoke-Command + Restart-Service [OK]
Hint: Use Invoke-Command for remote task automation [OK]
Common Mistakes:
  • Restarting services manually on each machine
  • Using Get-Process instead of Restart-Service
  • Running Restart-Service only locally without targets
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard