Bird
0
0

Which of the following is the correct syntax to pipe the output of Get-Process to Sort-Object by process name?

easy📝 Syntax Q3 of 15
PowerShell - Cmdlets and Pipeline
Which of the following is the correct syntax to pipe the output of Get-Process to Sort-Object by process name?
AGet-Process | Sort-Object -Property Name
BGet-Process Sort-Object | Name
CGet-Process Sort-Object Name
DGet-Process -Sort Name
Step-by-Step Solution
Solution:
  1. Step 1: Understand Sort-Object syntax

    Sort-Object requires the -Property parameter to specify the sorting property.
  2. Step 2: Evaluate each option

    Get-Process | Sort-Object -Property Name correctly pipes Get-Process output and uses -Property Name. Get-Process Sort-Object Name misses the pipeline operator. Get-Process Sort-Object | Name has wrong order. Get-Process -Sort Name uses invalid parameter.
  3. Final Answer:

    Get-Process | Sort-Object -Property Name -> Option A
  4. Quick Check:

    Sort-Object needs -Property for sorting [OK]
Quick Trick: Use -Property with Sort-Object for clarity [OK]
Common Mistakes:
  • Omitting -Property parameter
  • Misplacing pipeline operator
  • Using invalid parameters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes