Thursday, July 22, 2010

Sharepoint Backup Scheduling using Powershell

So long i have been waiting for a good topic to post!!
Here we go


This is about powershell backup script to automate sharepoint backups.

Hope most of you got a good idea about microsoft new revolution PowerShell. That even rocking Sharepoint 2010.
(To know more about Windows poweshell click
Here)
(To know more about Sharepoint poweshell click Here)

* Refers to the above links Windows powershell runs with powershell commands.
* These powershell script files will be stored with extension .ps1
* To run this script files user needs to be provided with powershell admin priviliges.
* You can use Backup-SPFarm to do it. For help and examples, type get-help Backup-SPFarm -examples.

For example, the follow script will start a full backup to .

Backup-SPFarm -Directory -BackupMethod full

Save it as .ps1 . You may need to use "set-executionpolicy RemoteSigned" to allow a local unsigned ps1 file to run.


And put the following as your scheduled command line, or inside your batch file....
powershell -command .ps1

In task scheduler, the account need to be set to the one who has admin permissions (or at least with powershell permission)

otherwise it cannot run properly.


When you do a Farm level backup, SharePoint tells SQL to do database dump to that location. Here are some things that have to

work in order for a farm backup to work:

1.Your Central Admin app pool account must have read/write access to the location of the backups.
2.Your SQL Service account must have read/write access to the location of the backups.
3.If you're running a farm backup from STSADM or Windows PowerShell, the account you're running it as must have read/write

access to the location of the backups
4.The location must be accessible from the SharePoint machine the backup is running on.
5.The location must be accessible from the SQL instance that SharePoint is trying to back up.
6.This is why all the examples are UNCs, \\server\share, and not local paths, C:\backups
7.Hope that helps


Go through following links which refers to write powershell script for Web applications,Site collections,Sites and lists or

libraries

http://technet.microsoft.com/en-us/library/ee428315.aspx

No comments: