Script-Based SharePoint 2007/2010 Site-Collection Backup - Part 2: Task Scheduling

This is the second installment of articles that describe a script-based method for creating backups at the site-collection level.

In part 1 I shared a script with a relatively long list of arguments that creates backup files for each site-collection in a web application. Since you will likely have more than one web application, we can simplify things by creating a CMD or BAT file (hard core, right?) that accepts only two arguments. These are things that will change for each web application, with the other script arguments likely being the same for each backup job.

It might look something like this:

CScript F:\Scripts\BackupSiteCollections.vbs %1 backuppath=%2 binpath="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN"

Keep in mind that you will want to adjust file/path names.

Now with this in hand we can create a scheduled task for each web application. What I do is set the Program to run as CMD with the following arguments:

/C F:\Scripts\BackupSiteCollections.cmd http://my.web.application "\\server\share\folder\"

So the argument breakdown is:

  • /C
    This tells the command interpreter (CMD) to execute the following command and then quit.
  • F:\Scripts\BackupSiteCollections.cmd
    This is the file we just created. Remember that it accepts two arguments.
    • http://my.web.application
      This is the URL for the target web application.
    • "\\server\share\folder\"
      This is the path to your backup location. I like to create a folder for each web app, personally.

Set up a task to back up each web application.

Have the tasks run as the farm administrator and allow them to run with highest privileges whether the user is logged on or not. When these run, you should see SCBackup (for Site-Collection Backup) files being created in your target share/folder.

The final part of this series will describe what I do to handle backup reporting and notifications.