Skip to content

Instantly share code, notes, and snippets.

@robert-moses
Last active July 22, 2018 21:47
Show Gist options
  • Save robert-moses/98a16994f62b85a9c9ae8226d6697bf0 to your computer and use it in GitHub Desktop.
Save robert-moses/98a16994f62b85a9c9ae8226d6697bf0 to your computer and use it in GitHub Desktop.
POSH, clean up log file (IIS, etc)
# Replace path with the path you want, include file name pattern/etc
# Replace time/age with what you want
# add this as a schedule task.
Get-ChildItem C:\Inetpub\logs* -Include u_ex*.log -Recurse | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-30)} | Remove-Item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment