Friday, October 19, 2012

Powershell Restore

In SharePoint 2010 you can take a backup of a site collection using the Backup-SPSite cmdlet:
Backup-SPSite http://SPPath C:\Backup\siteCollection.bak [-NoSiteLock]


Restoring a site collection in SharePoint 2010 is just as simple:
Restore-SPSite http://SPPath C:\Backup\siteCollection.bak

Restore-SPSite -Identity <Site collection URL> -Path <Backup file> [-DatabaseServer <Database server name>] [-DatabaseName <Content database name>] [-HostHeader <Host header>] [-Force] [-GradualDelete] [-Verbose]

If you want to restore the site collection to a specific content database, use the DatabaseServer and DatabaseName parameters to specify the content database. If you do not specify a content database, the site collection will be restored to a content database chosen by Microsoft SharePoint Server 2010.

If you are restoring a host-named site collection, use the Identity parameter to specify the URL of the host-named site collection and use the HostHeader parameter to specify the URL of the Web application that will hold the host-named site collection.

If you want to overwrite an existing site collection, use the Force parameter.