PowerShell - System AdministrationWhich of the following is the correct syntax to get the last 10 entries from the System event log in PowerShell?AGet-EventLog -LogName System -Last 10BGet-EventLog -LogName System -Newest 10CGet-EventLog -Log System -Last 10DGet-EventLog -LogName System -Top 10Check Answer
Step-by-Step SolutionSolution:Step 1: Identify correct parameter for log nameThe parameter to specify the log is '-LogName', so Get-EventLog -Log System -Last 10 is incorrect because it uses '-Log'.Step 2: Identify correct parameter for number of entriesThe correct parameter to get recent entries is '-Last', not '-Newest' or '-Top'.Final Answer:Get-EventLog -LogName System -Last 10 -> Option AQuick Check:Use -LogName and -Last for recent entries [OK]Quick Trick: Use -LogName and -Last to get recent events [OK]Common Mistakes:Using -Log instead of -LogNameUsing -Newest or -Top which are invalid parametersMixing parameter names
Master "System Administration" in PowerShell9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More PowerShell Quizzes Automation Patterns - Log cleanup automation - Quiz 13medium Cross-Platform PowerShell - AWS PowerShell module - Quiz 1easy Cross-Platform PowerShell - Why cross-platform extends reach - Quiz 2easy Cross-Platform PowerShell - Azure PowerShell module - Quiz 1easy Cross-Platform PowerShell - REST API calls with Invoke-RestMethod - Quiz 14medium Cross-Platform PowerShell - Azure PowerShell module - Quiz 13medium Remote Management - SSH-based remoting (PowerShell 7+) - Quiz 8hard Scripting Best Practices - WhatIf and Confirm support - Quiz 2easy System Administration - Registry operations - Quiz 7medium System Administration - Why PowerShell automates admin tasks - Quiz 12easy