WSS v3 Backup retention script

After setting up STSADM.exe to backup my WSS v.3 sites the backup directory did grow daily.

I could not find any way to set some sort of retention on these backups, and got tired of deleting the backups and adjusting the spbrtoc.xml manually. So I wrote my own script.

As a real PowerShell addict this problem had to be solved with PowerShell. Here’s the script.

This script does:

  • queries the spbrtoc.xml and finds all backups
  • deletes old backup entries from spbrtoc.xml
  • deletes the old backup files from disc
  • saves the updated spbrtoc.xml.

The result:



Just schedule this script to run after the backup has been made and no more manual deletion of the backup files is needed.

As a real IT Pro, you can now put your feet on the table and drink a relaxing cup of coffee. (Well at least until your boss finds you in this way…)