Bird
0
0

You run this command but get an error:

medium📝 Debug Q14 of 15
PowerShell - Cmdlets and Pipeline
You run this command but get an error:
Get-Service | Select-Object Name Status, DisplayName

What is the problem?
AGet-Service does not output objects with these properties.
BMissing commas between property names causes syntax error.
CSelect-Object cannot be used with Get-Service.
DThe command is correct and should not error.
Step-by-Step Solution
Solution:
  1. Step 1: Check property list syntax

    Properties must be separated by commas. Here 'Name Status' lacks a comma.
  2. Step 2: Understand error cause

    Without commas, PowerShell treats 'Name Status' as one invalid property, causing an error.
  3. Final Answer:

    Missing commas between property names causes syntax error. -> Option B
  4. Quick Check:

    Always separate property names with commas [OK]
Quick Trick: Separate property names with commas to avoid errors [OK]
Common Mistakes:
  • Forgetting commas between property names
  • Assuming spaces separate properties
  • Thinking Get-Service output is incompatible

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes