Site Collection Backup using PowerShell

PowerShell always gives the administrator the feel of programming, Basically I am a developer not really much into using the options or menus to do the tasks like backup (I never used the backup option in Central AdministrationJ)

Let’s talk about Backup of Site Collection using PowerShell with examples.

Syntax:

Backup-SPSite <<Site Collection URL>>

-Path <<File Path>>

[-Force]

[-Confirm]

[-NoSiteLock]

[-UseSqlSnapshot]

Example 1:

Backup-SPSite http://localhost -Path C:\SiteBackup.bak

Creates the backup of the site collection, the backup file will be stored in C: drive named as SiteBackup.bak

Example 2:

Backup-SPSite http://localhost -Path C:\SiteBackup.bak -Force

When the job is scheduled to take the daily backup, if the backup file already exists in the specified path, the backup process would be terminated.

Using -Force will enforce overwrite on existing file.

Example 3:

By default the Bacup-Site command let will set the site collection as read only, while the backup is in progress to avoid updates and/or prevent the backup file from corruption. Using -NoSiteLock switch will not lock the site collection to read only, while backup in progress.

Example 4:

Switch
UseSqlSnapShot will perform the backup using snapshots, this switch will work only with Enterprise Edition.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>