Log on Exchange 2010

Is it possible to clean the log (not the database log) on Exchange 2010 automatically as I see that there are many logs accumulated under C:\inetpub\logs\LogFiles\W3SVC1. Just wonder we can set the retention period for the log ...

Who is Participating?

Improve company productivity with a Business Account.Sign Up

Patrick BogersConnect With a Mentor Datacenter platform engineer LindowsCommented:

W3SVC1 is most probable the logs for the default website in IIS. (where OWA lives)
You can easily write some simple powershell script which deletes entries older then x days.

Code would look like this and the job would be a scheduled task.

# Delete all Files in C:\inetpub\logs\LogFiles on yourservername older than 7 day(s)

$Path = "C:\inetpub\logs\LogFiles"
$Daysback = "-7"
$CurrentDate = Get-Date
$DatetoDelete = $CurrentDate.AddDays($Daysback)
Get-ChildItem $Path -Recurse | Where-Object { $_.LastWriteTime -lt $DatetoDelete } | Remove-Item
Md. MojahidCommented:
As per me your can't do that.
AXISHKAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.