#sharepoint #backup #solutions
Backup and Restore SharePoint 2010 Site Collection with PowerShell
by Bradley Schacht Published July 13, 2011 Updated October 13, 2015
One of the most annoying processes with SharePoint is backing up a site collection. There is a build in tool that you can use but it is kinda clunky and can take a while to perform the backup. I used it once and was not impressed. PowerShell provides a quick and easy way to do site collection backups. My favorite part is that you can do the entire backup with one, uno, un, 1 (that s all I know for the number one so yeah) line of code. Just a little something to be careful of, you need to use the Windows SharePoint 2010 Management Shell, not the regular Windows PowerShell. I spent about 15 minutes trying to figure out why it (Windows PowerShell) didn t think that Backup-SPSite was a valid command. Here are the steps you should take. Note that doing the backup will put your site into a read only mode.
A PowerShell command prompt will appear and you need to format the following to fit the backup for your site.
Backup-SPSite -Identity SiteCollectionURLHere -Path BackupFilePathHere [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose]
I recommend creating a folder where you can place these backups before starting the backup process so they aren t just chillin on the C: drive of your SharePoint server; just a thought. Here is a little explanation of those additional parameters that are inside the braces [ ]
- Force Include this if you want to override a backup with the same name
- NoSiteLock Will prevent the site from going to Read Only mode while the backup is being taken. A small warning, if someone changes content on the site while the backup is being created and according to Microsoft might lead to possible data corruption
- UseSQLSnapshot A database snapshot will be taken before the backup begins and the backup will be done off the snapshot. The advantage is that changes can be made to the site while the backup process is running without fear of corruption. The snapshot will be deleted automatically when the backup is completed. You don t need to specify the -NoSiteLock parameter when using this method
Here is a simple example of what the script may look like if you want to just do a backup:
Backup-SPSite -Identity http://servername/sites/BISite -Path D:SharePointBackupsBISite