Backup and Restore a Site Collection using PowerShell

In a previous blog post, I was using the Copy-SPSite cmdlet to duplicate a Site Collection to another content database, within the same Web Application.

Today’s post will be about backing up a Site Collection & restoring it into another Web Application by using PowerShell.

Minimum requirements:

  • Permissions to run PowerShell cmdlets
  • Web Applications (source & target)
  • Site Collection to backup & restore


Create a folder to save the backup file

Let’s start by creating a folder to put our backup in, so we keep things organised and simple.


Backup folder created on the SharePoint Server


Choose the Site Collection to backup

  • Open PowerShell ISE (or SharePoint Management Shell if you prefer)
  • [optional] – Add the SharePoint Snap-in (if you use the ISE)

I’ve created a Site Collection called “Production” under my “portal” Web Application.
This is the Site Collection we are going to backup.

Get-SPSite | Where-Object {$_.Url -like "http://portal*"}

“Production” site collection to backup


Backup the Site Collection

Now is the time to use the Backup-SPSite cmdlet.

We need to have/know the following:

  • Full URL for the Site Collection (-Identity parameter)
  • Path to the folder “SPBackups” we created earlier (-Path parameter)
  • Name for the file (to save as <file>.bak)


Backup-SPSite -Identity -Path C:\Users\spinstall\Documents\SPBackups\production.bak




Backup folder containing the .bak



Restore the Site Collection into another Web Application

It’s extremely important to test your backup, and make sure it’s fully working, before deleting the Site Collection from its original Web Application.

I’ve also created a “Testing” Web Application (with associated database) where we are going to restore our Site Collection into, by using the Restore-SPSite cmdlet.


“Testing” Web Application to restore the Site Collection into



“Testing” database associated with the Testing Web Application


The target Site Collection URL must not be created. It will be created during the “restore” process.
Only the Web Application URL must be valid.

Restore-SPSite -Identity -Path C:\Users\spinstall\Documents\SPBackups\production.bak

Select “Yes to all” to confirm the action




If all went successfully, you can check the results!


New site collection in “Testing” Web Application and new database



New Testing DB containing the site collection restored



“Production” restored successfully on new Web Application


Comments are closed.

%d bloggers like this: