Lessons In Windows PowerShell - Introduction

   Submit to Reddit      

One of our Team Foundation Server build servers recently ran out of disk space. Upon closer investigation, we had 6 team projects building on that server, each with at least 3 different code branches, totalling more than 18 build folders - with each build folder larger than 2Gb. Do the maths, and that is essentially more than 40Gb being used.

Those folders however are not needed after a build has completed, and they can be safely deleted - so I decided that I would write a Windows PowerShell script to delete folders that haven't been written to for more than a day, and schedule the script to run through the Windows Task Scheduler.

Well, there was only one problem... I haven't really used PowerShell before. But, a couple of hours later, and I had the solution.

The start of this series of lessons reflects some of the lessons I quickly learned.

You can find more information on Windows PowerShell at the following links.

comments powered by Disqus