Script to remove IIS logs:
$start = (get-date).AddDays(-30)
Get-ChildItem -Path c:\inetpub\logs\logfiles\w3svc*\*.log | where {$PSItem.LastWriteTime -lt $start} | Remove-Item
Add this sctipt to windows scheduler, and logs will be remove automatically!
$start = (get-date).AddDays(-30)
Get-ChildItem -Path c:\inetpub\logs\logfiles\w3svc*\*.log | where {$PSItem.LastWriteTime -lt $start} | Remove-Item
No comments:
Post a Comment