0
0
PowerShellscripting~20 mins

Why PowerShell automates admin tasks - 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!
💻 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.