While working on an Exchange server last week I notice the 120GB drive was almost full. I had a guess what the issue was and I was right. The IIS connection logs were taking up 65GB of space. Now I could have just deleted all the files but someday I would have to come back and do it again. So instead I broke out a great little command to delete these log files every Sunday if the logs are older than 30 days. I’ve had this command archived for years now so I apologize that I can’t give credit to person who put it together originally – anyway here it is:
Open an command prompt as Administrator and type this in:
Take note of the Path as this can be in different place for you. Also if 30 days isn’t long enough you can change that by changing the –30 to –60 or –90 or whatever you like.
So that created the task but it has yet to run it, unless you have some time to kill to wait until Sunday for this to run you’ll want to kick it off on your own. So open your Task Scheduler and locate the command you just created, right click and choose Run.
If all went well when it completes it will say The operation completed successfully, (0x0)