$date = N - удаляем файлы старше N дней
$path - сами догадаетесь
Если удалить Whatif - будет и вправду удаляться.
$date = 30
$path = "C:\log"
Get-ChildItem $path | where { $_.lastwritetime -le ((get-date).AddDays(-$date)) } | Remove-Item -Whatif