Add these lines to scheduled tasks and run-as System:

Exchange logs older than 7 days:

IIS logs older than 7 days:

In Exchange 2013 this worked fine, but with Exchange 2016 You will get “Access Denied” for the folders.

Clear Exchange 2013 Log Files based on age.