Challenge - 5 Problems
PowerShell Automation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2: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, StatusAttempts:
2 left
💡 Hint
Think about how the command filters services by their status and selects only the first three.
✗ Incorrect
The command gets all services, filters those with Status 'Running', then selects the first three with their Name and Status properties. So the output is a list of three running services.
🧠 Conceptual
intermediate1: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?
Attempts:
2 left
💡 Hint
Think about how PowerShell handles data and system control.
✗ Incorrect
PowerShell uses an object-based scripting language that can access and control system components easily, making it ideal for automation.
🔧 Debug
advanced2: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-ServiceAttempts:
2 left
💡 Hint
Check if 'Get-Service' supports wildcards in its parameters.
✗ Incorrect
No error; 'Get-Service' accepts wildcards directly in the service name parameter (positional argument). The script gets services starting with 'A', filters running ones, then stops them (may prompt for confirmation unless -Force is used).
🚀 Application
advanced2: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?
Attempts:
2 left
💡 Hint
Think about how to handle multiple users efficiently with PowerShell.
✗ Incorrect
Automating user creation is best done by reading user info from a CSV and running New-ADUser in a loop.
📝 Syntax
expert3: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.
Attempts:
2 left
💡 Hint
Remember the correct operator for comparison and the order of filtering and sorting.
✗ Incorrect
Option C correctly filters running services, sorts by Name, then selects the Name property. Option C sorts before filtering, which is less efficient. Option C tries to filter after selecting Name only, losing Status info. Option C uses '=' instead of '-eq' causing assignment error.