Friday, April 22, 2011

Powershell script to Backup SharePoint 2010 Farm and Site Collections

To start a full farm backup,
Backup-SPFarm -BackupMethod Full -Directory "Destination-Directory"
-BackupThreads 5

When the above command is executed, a full farm backup will be performed with
five threads to perform the backup. You can specify up to 10 threads. However,
the fewer the backup threads, the easier it is to read the backup log file. You can
also specify "Differential" as the backup method to perform differential backup of
SharePoint farm. By default, this does not show the progress of backup

To see the progress as backup is performed:
Backup-SPFarm -BackupMethod Full -Directory "Destination-Directory"
-BackupThreads 5 –Verbose

To see a list of all items included in backup:
Backup-SPFarm –ShowTree

To perform a site collection backup:
Backup-SPSite -Identity "http://SharePointFix:101/" -Path "Path to Backup

To perform on site collection backup using SQL snapshots:
Backup-SPSite -Identity "http://SharePointFix:101/" -Path "Path to Backup
file" –UseSqlSnapShot

There is no option in the central administration to perform backup using SQL
snapshots. This can be done using PowerShell only. Also, using SQL Snapshots
is the recommended way to perform a site collection backup. This will allow users
to continue to read / write site collection content while the backup is in progress.

References: Knowledge Base article from