Task scheduler is required to automate the execution of backup files. In my last article, I have written about SharePoint full and differential backup, using central admin and PowerShell. Today, I am going to show you how to automate the execution of the backup file, using backup files script in task scheduler. Task scheduler is a constituent of Microsoft Windows that provides the ability to schedule the launch of the programs or the scripts at pre-defined times or after specified time intervals for task scheduling. With the help of task scheduling, we can reduce work for administrative department as well. We will get output efficiently without any extra resource utilized for the same.
Task scheduler was announced with Microsoft Windows 95 as a system agent, which was changed in successive operating systems by Microsoft. A task is clearly defined by associating or relating a set of actions, which can include launching an Application or taking some custom-defined action, to a set of triggers, which can either be time-based or an event-based. The function is available for task scheduler with those defined task states and configured accordingly.
Thus, let’s continue with how to configure Task Scheduler to automate the execution of backup files.
As we know, SharePoint 2013 backup structure and recovery processes includes farm backup and recovery. We can complete backup and recovery operations by using SharePoint central administration Website or Windows PowerShell cmdlets.
Refer to the URL given below for more details about backup in SharePoint 2013
The step by step configuration with the screenshots is given below.
-
Start PowerShell ISE with administrator rights and copy the command given below with modification, as per your environment.
-
One folder should be created on the local system or network and should be shared with full permission to copy the backup on the destination folder.
-
The command syntax which is given below for the same also shows you how to run it and what will be the result at the end.
Add-PSSnapin “Microsoft.SharePoint.PowerShell”
Set-ExecutionPolicy -ExecutionPolicy “Unrestricted” -Force.
Backup-SPFarm -BackupMethod Full -Directory \\MyServer\SPBackups
-
If we are going to run differential backup, we need to run PowerShell command given below.
Add-PSSnapin “Microsoft.SharePoint.PowerShell”.
Set-ExecutionPolicy -ExecutionPolicy “Unrestricted” –Force.
Backup-SPFarm -BackupMethod Differential -Directory \\MyServer\SPBackups -Item <ContentDatabaseName> [-Verbose].
-
Required changes are highlighted with RED: Please input your entry here for directory and content DB Name, if you are going for differential
-
Once modification is done, save those above script file on the local system drive with ending .PS1 file
-
Let’s create two files – one for the full backup and another for the diff backup.
-
Now, save those script files above with an appropriate name and one by one, you can save those file as fullbackup.PS1 and DiffBackup.PS1
Now, follow the steps given below to create the task for task scheduler to automate the execution of the script backup file.
-
Open Tools called tasks scheduler, using Windows button or command taskschd.msc.
-
In the center pane, right-click and click Create Basic Task or just click on the task, if we are going for full backup, we need to schedule this task weekly or monthly.
-
Assign the task; a meaning full name and description (Optional) and click Next.
-
Moving to the next tab, select trigger; when it wants to start this job, as we are going with full backup; it should be weekly or monthly.
-
Specify the parameter for the weekly task schedule like days and timing as well. Click Next to add action.

Join the conversation! Your thoughts help the community grow.