Bird
0
0

What will this command output?

medium📝 Command Output Q5 of 15
PowerShell - Cmdlets and Pipeline
What will this command output?
Get-Service | Where-Object { $_.Status -eq 'Running' } | Select-Object -First 3
AThe first three services that are currently running
BAll services regardless of status
CAn error because Select-Object cannot be piped
DNo output because no services are running
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the pipeline

    Get-Service lists all services; Where-Object filters those with Status 'Running'.
  2. Step 2: Understand Select-Object usage

    Select-Object -First 3 selects the first three items from the filtered list.
  3. Final Answer:

    The first three services that are currently running -> Option A
  4. Quick Check:

    Pipeline filters and selects first 3 running services [OK]
Quick Trick: Use Select-Object -First to limit output count [OK]
Common Mistakes:
  • Thinking Select-Object cannot be piped
  • Assuming all services are listed
  • Believing no services are running

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes