Fix: Windows SBS 2011 consuming a lot of space on C

With Windows SBS 2011, at one point I have noticed that it was consuming a lot of storage and only 10GB was left out of a 150GB partition. After further investigation I have noted that the INETPUB was consuming around 90GB. Actually the log files of the W3SVC1 doesn’t remove old log files.

You can either delete or crop these logs. A quick solution is to stop the World Wide Web service and delete the folder, but if you want to keep the recent logs, you can create a sheduled task which does the following.

Stop Service
Delete files in the W3SV1 folder which are older than 5 days

Script below

@ECHO OFF
CLS
ECHO ** STOP SERVICES **
NET STOP "TSGateway"
NET STOP "W3SVC"
ECHO ** DELETE OLD LOGS **
Forfiles.exe /P "C:\inetpub\logs\LogFiles\W3SVC1" /M *.log /D -5 /C "Cmd.exe /C del @path"
ECHO ** START SERVICES **
NET START "W3SVC"
NET STOP "TSGateway"

Leave a Reply

Your email address will not be published. Required fields are marked *