Backup-SPSite2

The Backup-SPSite cmdlet performs a backup of the site collection when the Identity parameter is used.

By default, the site collection will be set to read-only for the duration of the backup to reduce the potential for user activity during the backup operation which could corrupt the backup. If you have SQL Server Enterprise Edition, we recommend that UseSqlSnapshot parameter be used because this ensures a valid backup while it allows users to continue reading and writing to the site collection during the backup.

Backup-SPSite2 -Identity <SPSitePipeBind[]> [-IncludeIis [<SwitchParameter>]] [-Overwrite [<SwitchParameter>]] [-Path [<String>]] [-NoSiteLock [<SwitchParameter>]] [-UseSqlSnapshot [<SwitchParameter>]] [-AssignmentCollection [<SPAssignmentCollection>]]

Backup-SPSite2 -WebApplication <SPWebApplicationPipeBind[]> [-IncludeIis [<SwitchParameter>]] [-Overwrite [<SwitchParameter>]] [-Path [<String>]] [-NoSiteLock [<SwitchParameter>]] [-UseSqlSnapshot [<SwitchParameter>]] [-AssignmentCollection [<SPAssignmentCollection>]]

Backup-SPSite2 -Farm <SPFarmPipeBind> [-IncludeIis [<SwitchParameter>]] [-Overwrite [<SwitchParameter>]] [-Path [<String>]] [-NoSiteLock [<SwitchParameter>]] [-UseSqlSnapshot [<SwitchParameter>]] [-AssignmentCollection [<SPAssignmentCollection>]]

Parameters

1

ParameterRequiredTypeDescription
IdentityTrueSPSitePipeBind[]

The site to backup.

The type must be a valid GUID, in the form 12345678-90ab-cdef-1234-567890bcdefgh; a valid URL, in the form http://server_name; or an instance of a valid SPSite object.

IncludeIisFalseSwitchParameter

Include IIS settings in the backup.

OverwriteFalseSwitchParameter

Overwrite existing backups.

PathFalseString

Specifies the full path to the backup file (that is, C:\Backup\site_name.bak).

NoSiteLockFalseSwitchParameter

Specifies the site collection to remain read and write during the backup.

If the NoSiteLock parameter is not specified, then a site collection that has a site collection lock setting of "none" or "no additions" will be temporarily set to "read only" while the site collection backup is performed. Once the backup has completed, the site collection lock will return to its original state. The backup package will record the original site collection lock state so that it is restored to that state.

If users are writing to the site collection while the site collection is being backed up, then the NoSiteLock parameter is not recommended for potential impact to backup integrity

UseSqlSnapshotFalseSwitchParameter

Specifies a SQL Database Snapshot will be created when the backup begins, and all site collection data will be retrieved directly from the database snapshot. This snapshot will be deleted automatically when the backup completes.

The UseSqlSnapshot parameter is recommended if the database server hosting your content database supports database snapshots such as such as SQL Server Enterprise Edition and SQL Server Developer Edition. This is because it will ensure a valid backup while allowing users to continue reading and writing to the site collection during the backup. It is not necessary to specify the NoSiteLock parameter when specifying the UseSqlSnapshot parameter.

AssignmentCollectionFalseSPAssignmentCollection

Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

2

ParameterRequiredTypeDescription
WebApplicationTrueSPWebApplicationPipeBind[]

The web application to backup.

The type must be a valid URL, in the form http://server_name; or an instance of a valid SPWebApplication object.

IncludeIisFalseSwitchParameter

Include IIS settings in the backup.

OverwriteFalseSwitchParameter

Overwrite existing backups.

PathFalseString

Specifies the full path to the backup file (that is, C:\Backup\site_name.bak).

NoSiteLockFalseSwitchParameter

Specifies the site collection to remain read and write during the backup.

If the NoSiteLock parameter is not specified, then a site collection that has a site collection lock setting of "none" or "no additions" will be temporarily set to "read only" while the site collection backup is performed. Once the backup has completed, the site collection lock will return to its original state. The backup package will record the original site collection lock state so that it is restored to that state.

If users are writing to the site collection while the site collection is being backed up, then the NoSiteLock parameter is not recommended for potential impact to backup integrity

UseSqlSnapshotFalseSwitchParameter

Specifies a SQL Database Snapshot will be created when the backup begins, and all site collection data will be retrieved directly from the database snapshot. This snapshot will be deleted automatically when the backup completes.

The UseSqlSnapshot parameter is recommended if the database server hosting your content database supports database snapshots such as such as SQL Server Enterprise Edition and SQL Server Developer Edition. This is because it will ensure a valid backup while allowing users to continue reading and writing to the site collection during the backup. It is not necessary to specify the NoSiteLock parameter when specifying the UseSqlSnapshot parameter.

AssignmentCollectionFalseSPAssignmentCollection

Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

3

ParameterRequiredTypeDescription
FarmTrueSPFarmPipeBind

A valid SPFarm object.

IncludeIisFalseSwitchParameter

Include IIS settings in the backup.

OverwriteFalseSwitchParameter

Overwrite existing backups.

PathFalseString

Specifies the full path to the backup file (that is, C:\Backup\site_name.bak).

NoSiteLockFalseSwitchParameter

Specifies the site collection to remain read and write during the backup.

If the NoSiteLock parameter is not specified, then a site collection that has a site collection lock setting of "none" or "no additions" will be temporarily set to "read only" while the site collection backup is performed. Once the backup has completed, the site collection lock will return to its original state. The backup package will record the original site collection lock state so that it is restored to that state.

If users are writing to the site collection while the site collection is being backed up, then the NoSiteLock parameter is not recommended for potential impact to backup integrity

UseSqlSnapshotFalseSwitchParameter

Specifies a SQL Database Snapshot will be created when the backup begins, and all site collection data will be retrieved directly from the database snapshot. This snapshot will be deleted automatically when the backup completes.

The UseSqlSnapshot parameter is recommended if the database server hosting your content database supports database snapshots such as such as SQL Server Enterprise Edition and SQL Server Developer Edition. This is because it will ensure a valid backup while allowing users to continue reading and writing to the site collection during the backup. It is not necessary to specify the NoSiteLock parameter when specifying the UseSqlSnapshot parameter.

AssignmentCollectionFalseSPAssignmentCollection

Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

Detailed Description

The Backup-SPSite cmdlet performs a backup of the site collection when the Identity parameter is used.

By default, the site collection will be set to read-only for the duration of the backup to reduce the potential for user activity during the backup operation which could corrupt the backup. If you have SQL Server Enterprise Edition, we recommend that UseSqlSnapshot parameter be used because this ensures a valid backup while it allows users to continue reading and writing to the site collection during the backup.

Copyright 2016 Falchion Consulting, LLC

> For more information on this cmdlet and others:

> http://blog.falchionconsulting.com/

> Use of this cmdlet is at your own risk.

> Gary Lapointe assumes no liability.

Examples

------------------EXAMPLE 1-----------------------

PS C:\> Get-SPSite "http://server_name" | Backup-SPSite2 -IncludeIis

This example backs up the site located at http://server_name along with the IIS settings for the host web application.

------------------EXAMPLE 2-----------------------

PS C:\> Get-SPWebApplication "http://server_name" | Backup-SPSite2 -IncludeIis

This example backs up the web application located at http://server_name along with the IIS settings for the web application.