Bird
0
0

What is wrong with this command?

medium📝 Debug Q7 of 15
PowerShell - System Administration
What is wrong with this command?
Get-WinEvent -LogName Application -FilterXPath "*[System[(Level=2)]]" -MaxEvents 5
AThe XPath filter syntax is incorrect
BThe command is correct and will return 5 error events
CThe Level value should be a string, not a number
DThe parameter -MaxEvents cannot be used with -FilterXPath
Step-by-Step Solution
Solution:
  1. Step 1: Review XPath filter syntax

    The XPath filter *[System[(Level=2)]] correctly filters events with Level 2 (Error).
  2. Step 2: Check parameter compatibility

    -MaxEvents can be combined with -FilterXPath to limit results.
  3. Final Answer:

    The command is correct and will return 5 error events -> Option B
  4. Quick Check:

    Valid XPath and parameters = correct command [OK]
Quick Trick: XPath filters can be combined with -MaxEvents [OK]
Common Mistakes:
  • Thinking Level must be a string
  • Believing -MaxEvents conflicts with -FilterXPath
  • Misreading XPath syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes