Bird
0
0

Identify the error in this PowerShell script:

medium📝 Debug Q14 of 15
PowerShell - System Administration
Identify the error in this PowerShell script:
Get-Process | Where-Object { $_.Name -eq 'notepad' }
AMissing closing brace '}'
BNo error, script is correct
CIncorrect operator '-eq'
DWrong cmdlet name 'Get-Process'
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of Where-Object filter

    The script uses correct syntax with braces and -eq operator to filter processes.
  2. Step 2: Verify cmdlet names and operators

    Get-Process and Where-Object are valid cmdlets; -eq is correct for equality check.
  3. Final Answer:

    No error, script is correct -> Option B
  4. Quick Check:

    Script syntax and cmdlets are valid [OK]
Quick Trick: Check braces and cmdlet names carefully [OK]
Common Mistakes:
  • Assuming missing brace when it is present
  • Confusing -eq with other operators
  • Thinking cmdlet names are case-sensitive

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes