Script for removing old log files
- Shows number of files found
- Lists old files from given directory
- Adds scheduled task in the system to run on daily basis
Finds files 30 days old in given directory and asks what to do
.\Remove-RedundantLogFiles.ps1 -FolderPath C:\inetpub\logs\LogFiles
Finds files 5 days old in given directory and asks what to do
.\Remove-RedundantLogFiles.ps1 -FolderPath C:\inetpub\logs\LogFiles -DaysOld 5
Removes 10 day old files from given directory without any prompt and logs number of deleted files
.\Remove-RedundantLogFiles.ps1 -FolderPath C:\inetpub\logs\LogFiles -DaysOld 10 -RemoveFiles