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:

9 Responses to Scheduled and Automated SharePoint 2010 Backups

  1. shahzeb says:


    thanks for post but i think there is mistake in bat file.

    @echo off
    powershell C:\scripts\sharepoint_backup_full

    it shoule be like

    @echo off
    powershell C:\scripts\sharepoint_farm_full_backup.ps1

    correct me if i am wrong.

  2. IceaTronic says:

    Hi shahzeb,

    Thanks for taking the time to reply here!

    Initially, I thought the same thing as you, how ever, i found that when i was testing the script process, powershell was giving me an error when attempting to load the script. From the top of my head (as i performed this quite a while ago now) powershell was having issues finding the script and was effectively telling me it wasnt where i said it was.

    This was over come by using the batch file that I have provided here.

    Once again, thanks for the comment!



  3. Dan says:

    Very good post!

    One other thing to check, after the backup completes…Reload your sites and make sure you have full functionality, to everything, in your sites, including the ‘Site actions’ Button.

    In my case, when I reloaded my sites, a lot of functionality and permissions had disappeared…So, to solve this problem, I had to Unlock the site collection, again, via a Powershell command, to unlock.

    This may never happen in your case, but, it is a point worth considering, anyway!

  4. IceaTronic says:

    Fair point, i didnt run into this particular issue but having said that, Sharepoint is a funy ol’ girl so any number of things could have set it off and made the permissions get changed.

    Cheers for your input, always welcome!

  5. Dan says:

    Thank you for your reply, to my message. I think I had the SITELOCk enabled from a previous backup and that is what caused the issue, in m y case, to occur.

    However, there is one other thing which is giving me problems.
    In my backup statement if I add ‘-backupmethod full, or -backupmethod differential’ I keep getting an error and the backup fails.
    the error message is referring to parameters and says there is no matching parameter for -Backupmethod.
    This is utmost important for me, in that I want to be able to have the two types of backups operational.

    Has this issue arisen with anyone, previously?
    I would really appreciate, if someone could assist me, in this case.

  6. IceaTronic says:

    Howdy mate,

    Are you able to post the full error message that you are receiving as well as a copy of the script that you are running? Also, you are definitely using SharePoint 2010 and running the script from the Web Front End server?


  7. Guy says:

    I know this is a late response to this thread, but figured it would be helpful for anyone who needs to do this in the future. I found that you don’t need to use a ‘helper’ batch file to schedule the powershell script.

    Here’s the scheduled task command line that I use:

    c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -Noninteractive -command “. C:\scripts\sharepoint_farm_full_backup.ps1; exit $LASTEXITCODE”

  8. Nick says:

    I am looking for scheduled backup for a particular site, instead of full SharePoint sites.

  9. Stuart Anderson says:

    Just wondering if you knew how to create multiple back up files? right now if i use the -force it will overwrite the exsiting file.
    but how can i create multiple?


Leave a Reply

Your email address will not be published. Required fields are marked *