Tired of a huge amount off IIS logs?
$Location = [adsi]"IIS://localhost/w3svc" | select LogFileDirectory | %{$_.LogFileDirectory}
Dir "$Location\w3svc1\*.log" | ?{$_.LastWriteTime -lt (Get-Date).AddDays(-14)} | del
Add a scheduled task and call the powershell script using a cmd-wrapper
powershell.exe -command "& 'PathToYourScriptAbove.ps1'
No comments:
Post a Comment