Thursday, 15 May 2008

SharePoint Backup Script

This isn't the most advanced backup script you will ever see, but a) it works as a batch file so it is easy to modify and deploy, and b) it backs up more than the OOB tools do on their own, as follows:

- Deletes and recreates the folder structure for the backup target share
- Backs up site collections using stsadm (you will need to add the site collections that you wish to backup)
- Performs a farm backup using stsadm
- Copies the 12 hive across
- Performs an IIS metabase backup and copies the inetpub folder across
- Copies the Global Assembly Cache

For it to work, you will need to create a share on your backup server called "Backup" with the following permissions:

- SharePoint setup/administrator account - Full Control
- SQL Service Account - Full Control
- SharePoint Service/Server Farm Account - Full Control

Run the following command line on the backup server to do this for you:


And here is the backup script:

@echo off
echo =================================================
echo Backup SharePoint Farm
echo =================================================
CD\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
@echo off

rd \\BACKUPSERVER\Backup\SharePoint /s /q
md \\BACKUPSERVER\Backup\SharePoint
md \\BACKUPSERVER\Backup\SharePoint\12
md \\BACKUPSERVER\Backup\SharePoint\IIS
md \\BACKUPSERVER\Backup\SharePoint\GAC

echo Backing up site collections
stsadm -o backup -url -filename \\BACKUPSERVER\Backup\SharePoint\Portal.dat -overwrite

echo Backing up farm
stsadm.exe -o backup -directory \\BACKUPSERVER\Backup\SharePoint\ -backupmethod full

echo Backing up 12 hive
xcopy "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12" \\BACKUPSERVER\Backup\SharePoint\12 /s /e /c /h /f /r /k

echo Backing up IIS
del metabasebackup.*
cscript c:\windows\system32\iisback.vbs /backup /b MetabaseBackup /overwrite
xcopy metabasebackup.* \\BACKUPSERVER\Backup\SharePoint\IIS /s /e /c /h /f /r /k
xcopy c:\inetpub\*.* \\BACKUPSERVER\Backup\SharePoint\IIS /s /e /c /h /f /r /k

echo Backing up GAC
xcopy c:\windows\assembly\*.* \\BACKUPSERVER\Backup\SharePoint\GAC /s /e /c /h /f /r /k

echo Backup operation finished

Friday, 9 May 2008

Post-SP1 hotfix for UK My Sites released

The hotfix to enable new My Sites to be created with English (United Kingdom) regional settings has been published from KB article 942819 (

Install the fix and set the regional settings of the My Site Host site collection (i.e., the root site of your My Site Web Application) to UK. Any new personal site created will inherit these regional settings.