Скрипт на PS1

$days = 15
$dirs=@(
“C:\inetpub\logs\LogFiles\”,
“C:\Program Files\Microsoft\Exchange Server\V15\Logging\”,
“C:\Program Files\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Diagnostics\ETLTraces\”,
“C:\Program Files\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Diagnostics\Logs\”,
“C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\Logs\”
)
Get-ChildItem $dirs -Recurse -File | Where-Object { $_.Name -like “*.log” -or $_.Name -like “*.blg” -or $_.Name -like “*.etl” } | Where-Object LastWriteTime -lt (Get-Date).AddDays(-$days) | Remove-Item -ErrorAction “SilentlyContinue”

Добавляем в ежедневное задание.