Bird
0
0

What will this command output?

medium📝 Command Output Q5 of 15
PowerShell - System Administration
What will this command output?
Get-WinEvent -LogName Security -MaxEvents 2 | Format-Table Id, LevelDisplayName
AThe Id and LevelDisplayName of the 2 most recent Security log events
BAll Security log events with Id and LevelDisplayName
CAn error because Format-Table cannot be used here
DThe first 2 events from the Application log
Step-by-Step Solution
Solution:
  1. Step 1: Understand Get-WinEvent parameters

    -LogName Security targets the Security log; -MaxEvents 2 limits output to 2 events.
  2. Step 2: Format output

    Format-Table displays selected properties in a table format.
  3. Final Answer:

    The Id and LevelDisplayName of the 2 most recent Security log events -> Option A
  4. Quick Check:

    Get-WinEvent with -MaxEvents and Format-Table outputs limited event info [OK]
Quick Trick: Use -MaxEvents to limit Get-WinEvent output [OK]
Common Mistakes:
  • Confusing Security log with Application log
  • Thinking Format-Table causes errors
  • Assuming all events are returned

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes