SharePoint Backup Using PowerShell

PowerShell is a powerful scripting tool that comes as standard in a Windows Server 2008 R2 installation (for prior versions of Windows Server you should manually download and install PowerShell 2 here)

PowerShell can be very useful for automating tasks such as backing up SharePoint sites.

The below example demostrates a simple backup scenario where PowerShell is used to backup and entire SharePoint site:

  1. Open a new text file and enter Backup-SPFarm -Directory D:Backup -BackupMethod full
  2. Save the file as D:ScriptsSharePoint_Backup.ps1.  Note, that you may need to use “set-executionpolicy RemoteSigned” to allow for running of a local unsigned ps1 file.
  3. Enter powershell -command E:ScriptsSharePoint_Backup.ps1 in the command line (or alternatively in a batch file).
  4. In the Task Scheduler, make sure that the account has admin permissions. For details on how to use the Task Scheduler see here.

When doing SharePoint farm backups, SharePoint instructs SQL Server to perform database dump to your chosen location so there are some issues to note to avoid complications with the backup task :

  • The Central Admin app pool account will require both  read and write access to the backups’ location.
  • The SQL Server Service account will require both  read and write access to the backups’ location.
  • When performing a farm backup using  STSADM or  PowerShell, the account running it will require both  read and write access to the backups’ location
  • The location will need to be accessible from the SharePoint system the running the backup.
  • The location will need to be accessible from  the SQL Server instance that SharePoint is attempting to back up.



Array

No comments yet... Be the first to leave a reply!