Bird
0
0

You want to create a list of services showing only their DisplayName and Status, but sorted by Status. Which command achieves this?

hard📝 Application Q8 of 15
PowerShell - Cmdlets and Pipeline
You want to create a list of services showing only their DisplayName and Status, but sorted by Status. Which command achieves this?
AGet-Service | Select-Object -Property DisplayName | Sort-Object -Property Status
BGet-Service | Sort-Object DisplayName, Status | Select-Object -Property DisplayName
CGet-Service | Sort-Object -Property Status | Select-Object -Property DisplayName, Status
DGet-Service | Select-Object DisplayName, Status | Sort-Object -Status
Step-by-Step Solution
Solution:
  1. Step 1: Understand sorting before selecting

    Sorting should happen before selecting properties to avoid errors.
  2. Step 2: Analyze options

    Get-Service | Sort-Object -Property Status | Select-Object -Property DisplayName, Status sorts by Status first, then selects DisplayName and Status correctly.
  3. Final Answer:

    Get-Service | Sort-Object -Property Status | Select-Object -Property DisplayName, Status -> Option C
  4. Quick Check:

    Sort first, then select properties [OK]
Quick Trick: Sort objects before selecting properties to keep all data [OK]
Common Mistakes:
  • Selecting properties before sorting causing missing data
  • Incorrect parameter order
  • Using Sort-Object without -Property

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes