Jim Ehrenberg

Sr. Certified SharePoint/O365 Architect/SME, MCP (Freelance)


SharePoint 2013 Backup with PowerShell and Task Scheduler for beginners

An oldie but a goodie. Courtesy of Yousef Omar


You can do Everything with PowerShell – yes everything – and SharePoint is no exception. In this post for beginners, I will show you how to create tasks for the Task Scheduler to automate your SharePoint backups with PowerShell.

First, to backup your farm, you can use the PowerShell command Backup-SPFarm. For more details on this cmdlet, refer to http://technet.microsoft.com/en-us/library/ff607881.aspx. You can use the command to backup the farm a full backup as in the following example.

Backup-SPFarm -BackupMethod Full -Directory \\MyServer\SPBackups

And to backup the farm a differential backup, you can use the command as in the following example

Backup-SPFarm -BackupMethod Differential -Directory \\MyServer\SPBackups

To create a PowerShell script file, open a notepad file and save it as *.ps1. Let’s create two files – one for the full backup and another for the diff backup.

So create two files: SPFarmFullBackup.ps1 and SPFarmDiffBackup.ps1

In the first file for the full backup, type the following text.

Add-PSSnapin “Microsoft.SharePoint.PowerShell”

Set-ExecutionPolicy -ExecutionPolicy “Unrestricted” -Force

Backup-SPFarm -BackupMethod Full -Directory \\MyServer\SPBackups

Save the file.

In the second file for the differential backup, type the following text.

Add-PSSnapin “Microsoft.SharePoint.PowerShell”

Set-ExecutionPolicy -ExecutionPolicy “Unrestricted” -Force

Backup-SPFarm -BackupMethod Differential-Directory \\MyServer\SPBackups

Save the file.

Now, follow the steps below to create the tasks for Task Scheduler to automate the execution of backup files – let’s assume we will full-backup weekly and diff-backup daily.

1 – Open Tools > Tasks Scheduler

2 – In the center pane, right-click, and click Create Basic Task

3 – Assign the task a meaningful name – such as SharePoint-BackupFullWeekly

4 – Choose “Weekly ” on the When do you want the task to start screen

5 –  Specify the parameter for the weekly task schedule

6 –  Choose “Start a program” from the what action do you want the task to perform

7 –  On the start a program screen type in the command as the screenshot below. The Task scheduler is intelligent enough to recognize that you want to run PowerShell and that you supplied arguments.

Repeat the steps above to create a task for the diff backup.


Good Luck!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Michael Sampson

Exploring. Envisioning. Equipping.

SharePoint Librarian

Solutions and ideas for developing digital collaborative environments with Office 365.

Joanne C Klein

SharePoint, Office 365 and Azure Things

Site Title

Welcome to your new home on WordPress.com

Geoff Varosky's Blog

SharePoint, Office 365, Azure, and Other Musings...

Jim Ehrenberg

Sr. Certified SharePoint/O365 Architect/SME, MCP (Freelance)

Cameron Dwyer | Office 365, SharePoint, Outlook, OnePlace Solutions

Office 365, SharePoint, OnePlace Solutions & Life's Other Little Wonders

Next Gen eDiscovery Law & Tech Blog

Legal and tech perspectives on eDiscovery, virtualization and enterprise search

Medical Billing Reviewers

Why overpay your medical bills?

Views from Veronique

SharePoint, Running a Business, Natural Living

Fabian Williams SharePoint Blog

Solving problems with SharePoint day and night

The SharePoint Swiss Army Knife

Stories from a SharePoint Engineer who isn't afraid of Visual Studio.

The WordPress.com Blog

The latest news on WordPress.com and the WordPress community.

%d bloggers like this: