Pages

Saturday, September 19, 2015

Backup and Restore a SharePoint Site Collection using PowerShell

In this article you are going to see that how to backup and restore SharePoint site. You need to use SharePoint management shell instead of regular Windows PowerShell.
You can use the Granular Backup option in SharePoint Central Administration to back up a site collection however you can only restore site collection using SharePoint Management Shell.

Simply follow this steps for:

Backup a Site Collection
  1. Open SharePoint 2010 Management Shell as Administrator (Run as administrator).
  2. Type the following command.
Backup-SPSite -Identity [SITECOLLECTIONURL] -Path [BACKUPFILEPATH] [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose]

Replace [SITECOLLECTIONURL] with the URL of your site collection.
Replace [BACKUPFILEPATH] with the Path where your backup file should be saved.

Ex: Backup-SPSite -Identity http://servername/sites/mysite -Path D:\MySiteCollection.bak [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose]

Your backup should be created on the selected path.

Restore a Site Collection
  1. Open SharePoint 2010 Management Shell as Administrator (Run as administrator).
  2. Type the following command.
Restore-SPSite -Identity [SITECOLLECTIONURL] -Path D:\MySiteCollectionBackup.bak –Force

Replace [SITECOLLECTIONURL] with the URL of your site collection which the backup should be restored.
Replace [BACKUPFILEPATH]  with the Path where your backup file is located.

Ex: Restore-SPSite -Identity http://servername/sites/newsite -Path D:\MySiteCollection.bak -Force

Your backup file should be restored on the provided URL.

No comments:

Post a Comment