SharePoint 2010 Powershell script to create a Site Collection Backup

SharePoint 2010 Powershell script to create a Site Collection Backup

Backup-SPSite -Identity http://sharepoint.name/sitecollection1 -Path \\UNCPATH\to\save\location\sitecollection1.bak

This command will make the site collection read only while it runs.
In order to leave the site writeable, use the versin below

Backup-SPSite -Identity http://sharepoint.name/sitecollection1 -nositelock -Path \\UNCPATH\to\save\location\sitecollection1.bak

This can be batched.  Just save the file as a .ps1 file and then open powershell, navigate to the path where the file lives, and type .\filename.ps1

This displays no output though, so I added text output to tell me the time a backup started and when it finished. The finished script is below.

$StartDate = Get-Date; "Started SiteCollection1"
Backup-SPSite -Identity http://sharepoint.name/sitecollection1 -Path \\UNCPATH\to\save\location\sitecollection1.bak
$EndDate = Get-Date; "SiteCollection1: Started at $StartDate and  Completed at $EndDate"
 

Comments

Popular posts from this blog

Setting SharePoint announcements to auto delete after expiration

Updating a single field in a SharePoint List using Power Automate Flows

SharePoint driven rich text dashboard using jqueryui. (JQuery file)