Search Tools Links Login

Delete IIS Logs Automatically


On web servers, and Exchange OWA servers especially, there are a lot of OWA logs which can be found in C:\inetpub\logs\LogFiles\W3SVC1.

This small Powershell script can be useful, it will delete IIS Log files older than 60 days:

get-childitem -Path C:\inetpub\logs\LogFiles\W3SVC1 -recurse | where-object {$_.lastwritetime -lt (get-date).addDays(-60)} | Foreach-Object { del $_.FullName }

About this post

Posted: 2022-08-25
By: dwirch
Viewed: 149 times

Categories

IIS

Scripting

Powershell

PowerShell Code Cache

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.