Automated Sharepoint Backups including daily folders and trash collection

SAMS came up with a great SharePoint backup automation tool with their SPSiteBackup.wsf windows script file - it is good, but needed a couple things... so I added them...

The SAMS backup utility is really pretty great.  It runs backups on all of your site collections on a given site as well as as logging the results and emailing the logs to users.  This is very useful, but it is lacking a few features that I felt it needed.

 

First of all, the backup utility put all of the backup files into one directory.  When you have a lot of sites, not to mention if you are backing up MySites, this can become a massive chunk of data.  If you are running this script on any recurring basis, it just turns into a non-decipherable mess of hundreds and hundreds of files, no organization whatosever.  I made a change here that will automatically make folders (named by date) and place the backups in the properly dated folder.

 

Second, there is no garbage collection.  If I ran the script every day, I would eventually choke out all of my storage and be stuck with 100s of GBs of backups.  I could just go in and delete them manually, but no one wants to do that (so 90s).  What if I forget, or go on vacation, or leave Tongue out - so, I made a garbage collection method run within the script as well.

 

All you need to do is place the script file directly on your C: drive, customize the batch file (explanation provided within the .bat file) and schedule it to run (or run it manually) and you are running maintenance-free automatic backups on your SharePoint server/farm.

 

 

 

 

Ok, if you feel ok on your own now, stop reading - if not, read on for a step-by-step tutorial on how to schedule the automated backups on your server...

 

Get the backup script files ready  

  1. Copy the 2 files from the .zip file to the machine you want to run backups on directly to the C: drive
  2. Open spBackup.bat in a text editor, you will see the following:
    cscript c:\spBackupScript.wsf
    /virt:"http://your_sp_site"
    /path:"path_for_backups"
    /smtpserver:"YOUR_SMTP_SERVER"
    /reportto:"send_reports_to@this_email.address"
    /holdfor:"number_of_days_before_backups_are_deleted(integer)"
  3. Change the input variables to what you need them to be (self-explanatory) for that server instance.

 

Now that is set up, you need to schedule the job.

  1. Click Start->Programs->Accessories->System Tools->Scheduled Tasks
  2. Double-click Add Scheduled Task, choose Next
  3. Click Browse... and browse to the .bat file you just edited (C:/spBackup.bat)
  4. Name the task and choose how often to perform the task click Next
  5. Choose the start time click Next
  6. Enter your password click Next
  7. Click Finish

 

It's just that easy, you are now making and cleaning up backups automatically.  Here it is one more time:

 

 

Automated_SP_Backup.zip (3.60 kb)

Adventures in Migrating from WSS 2.0 to MOSS 2007

"Your backup is from a different version of Windows Sharepoint Services and cannot be restored to a server running the current version."

DAMN YOU SHAREPOINT! NO IT ISN'T!!!


That was the error I have been facing for a couple of days and it was driving me utterly crazy.


This was my situation: I was tasked with migrating the sharepoint data on an ancient server (PIII 512 RAM) running WSS 2.0 and SQL 2000 to a new server running MOSS 2007 and SQL 2005 - I have done plenty of backups and restores on SharePoint, and they are suprisingly easy.  This should be no problem...


Wrong. This turned into a classic battle of me vs. some software, and I refused to let it win! (plus, my boss would be pissed).


You can read the [Details of the battle] or just read on for the solution.

 

Turns out that even though WSS Backup/Restore was supposed to be compatible with SQL 2005, they didn't actually make it compatible until SP3.  So, despite not even being the same version anymore, it seemed to work just fine EVEN THOUGH THE ERROR CLEARLY STATED THAT MY VERSIONS WERE DIFFERENT!  I think they need to revise that error message before someone stabs their eyes out!


So it turns out that all you have to do is this:

 

  1. Update both servers to WSS 2.0 SP3
  2. Backup your initial server using stsadm
  3. Restore to your new machine using stsadm
  4. Upgrade your new system to MOSS 2007 

 

That's it... thats the whole answer to my week long battle with WSS.  Now I just have to upgrade to MOSS 2007.  You can get SP3 here: WSSSP3-KB923643-FullFile-ENU.zip (6.19 mb) - hopefully this saves someone a whole bunch of hours on a ridiculous problem, though no one even uses WSS 2.0 anymore...