With all the happenings with in the SharePoint Multiverse, I needed to come up with a method to perform a SharePoint Farm Backup on a scheduled basis.

To perform this function, i have found a nifty feature within the SharePoint Powershell console which will perform full and incremental backups of a SharePoint Farm and allow you to dictate where these backups are then placed.

The script it self is fairly straight forward and looks something like this:

Add-PSSnapin Microsoft.SharePoint.PowerShell
backup-spfarm -directory “(local directory or UNC path)” -backupmethod full

Within the script you can also substitute out the ‘full’ option for an ‘incremental’ as well. Save the script some where easy to remember such as’ C:\Scripts’

What i have ended up doing, is putting this in power shell script and naming is sharepoint_farm_full_backup.ps1. From here, i have then created a simple 3 line batch file which then calls powershell and the script:

@echo off
powershell C:\scripts\sharepoint_backup_full


Save this in the same folder as the PowerShell scripts that you created as something to indicate that this will launch the full backup, say’ full_backup_launch.bat’.

Then you need to configure the Scheduled Task to run. This is a fairly straight forward step, with one gotcha that ive found. Ill explain in a moment.

First, you need to create your New Scheduled Task. Name it something logical, ‘SharePoint Farm Full Backup’. Make sure that you run the task  as some one that has sufficient privileges over your SharePoint Farm. When on the account details page, MAKE SURE that you tick ‘Run with highest privileges’ to ensure that the account calls its ‘Admin’ counterpart to run the script for you. In the actions page, tell the task to look at the batch file that youve created.

When done, set up your schedule and away you go!

Tagged with: