I wanted to do a presentation at the local SharePoint user group meeting recently and decided that I should show how to build a custom extension. I decided that rather than use an existing one I would build a new command from scratch. Problem was coming up with something that people could use. I decided that the issue of the built-in backup command not handling IIS settings would be a good area to target. I first created the command detailed here, gl-backupsites, but eventually I created a simpler command (gl-backup) which I'll discuss in a follow up post.
The gl-backupsites command basically takes the simpler built-in backup command and extends it so that you can also backup the IIS settings as well as multiple site collections without having to script each one individually. The benefit of this is that you could use this command to backup all site collections on a regular basis without having track what site collections are created. Note that this can also be used to backup the SSP and CA content databases which the disaster recovery option of the built-in backup command will not capture.
The complete code can be seen below:
The syntax of the command can be seen below:
C:\>stsadm -help gl-backupsites stsadm -o gl-backupsites Backup all sites within the specified scope. If the scope is farm or webapplication then IIS will also be backed up. Parameters: -path <path to backup directory (all backups will be placed in a folder beneath this directory)> [-scope <Farm | WebApplication | Site>] [-url <url of web application or site to backup (not required if the scope if farm)>] [-includeiis] [-overwrite]
Here's an example of how to backup all site collections within a given web application while also including the IIS settings:
stsadm -o gl-backupsites -url http://portal -scope WebApplication -includeiis -path c:\backups