Display the amagent.log in the Activity Log for Windows

Worklet: Display amagent.log contents in Activity Log for Windows

The following Worklet provides for two possible outputs to the Activity log from the local amagent.log

Requirements:

  • Windows

Create a new Worklet, see Creating a Worklet

Evaluation Code:

exit 1

Remediation Code for the entire log:

#Entire log
$logTest = Get-Content "C:\ProgramData\amagent\amagent.log"
Write-Output $logTest
exit 0

 

Remediation Code for the most recent 100 lines:

#Last 100 lines
$logTest = Get-Content "C:\ProgramData\amagent\amagent.log" -Tail 100
Write-Output $logTest
exit 0

Altering the number after -Tail will allow for other numbers of lines to be chosen. 
Example to display 20 lines: 
$logTest = Get-Content "C:\ProgramData\amagent\amagent.log" -Tail 20

Was this article helpful?
0 out of 0 found this helpful