This script contains information from other scripts and combined to give you a working PS1 file that will go and remove all the log files generated by Exchange 2013 and Exchange 2016 and now on Exchange Server 2019 which is not automatically truncated.

You can schedule this using Task Scheduler to run X number of times a day or week.

You are more than welcome to change the script.

The script contains a value XDays, you can change this to specify the log files that need to be removed.

*V2 - Includes the Log files in the Ceres folder and the ETL traces folder

*V3 - ClearLogs (1).PS1 (orginal script, some people reporting access denied errors in the script)

**Update** Tested the script on Exchange Server 2019 Public Preview and it clears the logs without any error.