Get-Scripting




 

 

Exchange 2013 introduced the need to keep an eye on disk-space. Microsoft introduced managed availability as a means to keep exchange in tip top condition or at least to keep exchange running for longer. According to this TechNet article, "Managed Availability is a monitoring and recovery infrastructure that is integrated with Exchange’s high availability solution. Managed Availability detects and recovers from problems as they occur and as they are discovered." Unfortunately space management is the one thing that this magnificent feature of Exchange 2013 fails to address. In fact this is the one problem Iam aware of which is introduced by managed availability. Exchange 2013 requires you to have at least 30gb of free space on the volume where exchange files are stored. You are probably wondering what this has got to do with "Forfiles", I wanted to create a batch file to delete all log files older than a given time period. I was too lazy to write my own powershell script or vbscript. So I went googling and I stumbled upon this command Forfiles on this website. Instead of me writing 10Lines of Powershell to loop through and delete files older than 7 days the command below does it

 

forfiles /p "C:\temp" /s /m *.* /c "cmd /c Del @path" /d -7

In the end, I just scheduled this task as shown below and my problem went away. This command has been available since Vista showed up and am sure will be around forever....

 

Surely scripting will not get better than this...

Who has been here?