Create a scripts folder with a logs subfolder. Use notepad and create a file named C:\Scripts\ClearLog.ps1 with this content.
$LogFile = "C:\Scripts\Logs\ClearLog.log" # Your log file
$WebPage = "http://X.X.X.X:8080/DeleteLog/DeleteLog.jsp" # Your page to call
"{0} - Calling log clear page." -f (Get-Date) | out-file $LogFile
try {
$Result = Invoke-WebRequest -Uri $WebPage -ErrorAction Stop
"{0} - Status code is {1}" -f (Get-Date), $Result.StatusCode | out-file $LogFile -Append
# Review $Result.content for page output.
}
catch {
"{0} - We crashed: {1}" -f (Get-Date), $_ | out-file $LogFile -Append
}
"{0} - Script end." -f (Get-Date) | out-file $LogFile -Append
Define a task and have it run:
Powershell.exe -ExecutionPolicy Bypass -file C:\Scripts\ClearLog.ps1
Set the task to run as the SYSTEM account initially. Run the task and review the log file.