Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$logsDirectory = ‘C:\Program Files\Microsoft\Exchange Server\V15\Logging’
$days = '7'
Get-ChildItem $logsDirectory -Include '*.log' -Recurse | Where-Object {$_LastWriteTime -lt (Get-Date).AddDays($days)} | Remove-Item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.