Friday, April 8, 2011

Exchange 2007 PS Script to purge W3SVC1 logs

We have had issues where the IIS logs have been filling up our C drive on both our Mailbox Servers . This is the result of IIS web and Active Sync activity. The following PowerShell Script will purge logs older than 5 days as scheduled Windows Task. 

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

Thanks to the exchange 2007 Technet forums. 

No comments:

Post a Comment