Bird
0
0

Identify the error in this command:

medium📝 Debug Q14 of 15
PowerShell - Cmdlets and Pipeline
Identify the error in this command:
Get-Service | Where-Object $_.Status -eq 'Running'
AMissing curly braces around the condition
BIncorrect property name 'Status'
CWrong operator used for comparison
DNo error, command is correct
Step-by-Step Solution
Solution:
  1. Step 1: Check Where-Object syntax

    Where-Object requires the condition inside curly braces {} to form a script block.
  2. Step 2: Analyze the given command

    The command misses curly braces around $_.Status -eq 'Running', causing syntax error.
  3. Final Answer:

    Missing curly braces around the condition -> Option A
  4. Quick Check:

    Where-Object needs { condition } [OK]
Quick Trick: Always wrap condition in { } for Where-Object [OK]
Common Mistakes:
  • Omitting curly braces
  • Assuming property names are wrong without checking
  • Confusing operators

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes