Challenge - 5 Problems
Service Management 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 command run on a Windows machine with a service named 'wuauserv' (Windows Update service). What will be the output type of this command?
PowerShell
Get-Service -Name wuauserv | Select-Object -Property Status
Attempts:
2 left
💡 Hint
Think about what Select-Object does when you specify a property.
✗ Incorrect
Get-Service fetches the service object. Select-Object with -Property Status returns only the Status property in a table format, not the full service details or all services.
💻 Command Output
intermediate2:00remaining
What happens when you run this command on a stopped service?
You run the following command on a service named 'Spooler' which is currently stopped. What will be the output?
PowerShell
Start-Service -Name Spooler; Get-Service -Name Spooler | Select-Object -Property Status
Attempts:
2 left
💡 Hint
Start-Service changes the service state if possible.
✗ Incorrect
Start-Service starts the service if it is stopped. Then Get-Service shows the updated status, which should be 'Running'.
📝 Syntax
advanced2:00remaining
Which command correctly stops a service and waits for it to stop?
You want to stop the service named 'bits' and ensure it is fully stopped before continuing. Which command is correct?
Attempts:
2 left
💡 Hint
Look for a way to wait for the service status after stopping it.
✗ Incorrect
Option A stops the service with -Force and outputs the service object with -PassThru, then pipes it to Wait-Service which waits until the status is 'Stopped'. Other options either don't wait properly or use invalid parameters.
🔧 Debug
advanced2:00remaining
Why does this script fail to start the service?
This script is supposed to start the 'w32time' service but fails with an error. What is the cause?
PowerShell
if ((Get-Service -Name w32time).Status -eq 'Running') { Write-Output 'Service already running' } else { Start-Service -Name w32time Write-Output 'Service started' }
Attempts:
2 left
💡 Hint
Starting services usually requires special permissions.
✗ Incorrect
Starting or stopping services requires administrator rights. Without them, Start-Service throws an error. The script syntax and service name are correct, and Get-Service returns Status.
🚀 Application
expert3:00remaining
How to create a script that restarts a service only if it is running?
You want a PowerShell script that restarts the 'Spooler' service only if it is currently running. Which script correctly does this?
Attempts:
2 left
💡 Hint
Check the service status before restarting it.
✗ Incorrect
Option B checks if the service is running before restarting it. Option B restarts regardless of status. Option B stops and starts without checking. Option B tries to pipe service objects to Restart-Service, which does not accept pipeline input.