CompTIA CySA+ (CS0-002) — Question 13

Massivelog.log has grown to 40GB on a Windows server. At this size, local tools are unable to read the file, and it cannot be moved off the virtual server where it is located. Which of the following lines of PowerShell script will allow a user to extract the last 10,000 lines of the log for review?

Answer options

Correct answer: D

Explanation

The correct answer, D, uses the PowerShell cmdlet 'get-content' with the '-Last' parameter to retrieve the last 10,000 lines and redirects the output to 'extract.txt'. Option A is incorrect because 'tail' is not a valid command in PowerShell. Option B contains syntax errors and is not a valid PowerShell command. Option C uses an incorrect cmdlet syntax for output redirection.