How to Backup SharePoint Site Collection using PowerShell?

Himanshu Goyal Himanshu Goyal Updated On - 25 Oct 2019

Microsoft SharePoint is amongst one of the most used cloud services by large enterprises as well as small organizations. The benefit of using a SharePoint is that it provides multiple features and functionalities, such as Document Library, Sites, etc. In SharePoint, a Site Collection is a collection of various sites, each site collection containing a single top-level site and subsites.

Though it is recommended to backup the entire SharePoint farm, you can back up SharePoint site collection as well. It is crucial to back up SharePoint Site collection so that during any disaster, your data remains safe. But, backup of SharePoint Site collection is a bit complicated, as you need to use PowerShell cmdlets or Central administration for manual backup, which is often not an ideal choice for non-technical users.

In this article, we will discuss how you can backup the SharePoint Site collection with SharePoint Management PowerShell commands. But before that, there are some things to keep in mind.

Things to Know before SharePoint Site Collection Backup

  • Create a folder on your system to store the backup data
  • The Site collection Lock status is set to Not Locked or Adding content prevented, which automatically sets to Read-Only status during the backup operation
  • For site collection backup, you need resources, or it can affect the farm performance during backup

Using PowerShell to Backup Site Collection

There are a few steps involved in using PowerShell cmdlets to backup SharePoint site collection. The steps are as follows:

  1. Verify the below-mentioned memberships on the SQL Server instance:
    • securityadmin fixed server role
    • db_owner fixed database role on all databases that are to be updated
    • Administrator group on the server on which you need to run the PowerShell cmdlets

    As an administrator, you can use the Add-SPShellAdmin cmdlet for granting permission to use SharePoint Server cmdlets.
    Note: Without these permissions, you cannot perform the backup. Thus, contact your administrator and request permissions.

  2. Now, start the SharePoint Management Shell.
  3. When the PowerShell command prompt, use the below cmdlets:
    Backup-SPSite -Identity <Site Collection URL or GUID> -Path <Backup File path> [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose]

    Note: To overwrite a previously used backup file, use Force parameter. Use the NoSiteLock parameter to keep the read-only lock from being set on the site collection during the backup.
    But, using the NoSiteLock parameter can lead to certain data corruption in SharePoint site collection during backup. So, use the following command to display site collection GUID or URL at the PowerShell command prompt:

    Get-SPSite | format-list -property id,url

If your Database server is using an Enterprise edition of SQL Server, then it is recommended to use the UseSqlSnapshot parameter for the backup of the SharePoint. With the help of this parameter, you can export sites or lists even from these snapshots. You can learn about how to use SQL snap-shots from the Microsoft site.

With the manual method, one thing is for sure that it is very complicated and cannot be used by every user. So, there is a better alternative to the manual method – Kernel SharePoint Migrator, that allow you to download your SharePoint Site Collection to your system, and then move to another drive or server. SharePoint Migration tool has many additional functionalities that make it an excellent choice for SharePoint backup.

Conclusion

Backup of SharePoint site collection is not that easy as it seems to be, especially with the manual methods. So, in this article, we discussed how you could backup the SharePoint site collection with PowerShell cmdlets. Also, we have recommended a third-party software that is more ideal for this task.