In this post,I will show you SharePoint 2013 How to Backup Farm Automatically with a PowerShell and Windows Task Schedule. First,to backup your Farm,you can use the powershell command Backup-SPFarm.
You can use the command to backup the farm a Full backup as in the following example.
Backup-SPFarm -BackupMethod Full -Directory D:\backup
And to Backup the farm a differential backup,you can use the command as in the following example.
Backup-SPFarm -BackupMethod Differential -Directory D:\backup
So Let's Create two PowreShell Script File,One for the full backup and another for the differential backup.
Add-PSSnapin Microsoft.SharePoint.PowerShell
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force
Backup-SPFarm -BackupMethod Full -Directory D:\backup
Save the file and name SPFarmFullBackup.ps1
Add-PSSnapin Microsoft.SharePoint.PowerShell
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force
Backup-SPFarm -BackupMethod Differential -Directory D:\backup
Save the file and name SPFarmDiffBackup.ps1
Now,follow the steps below to create the tasks for Task Schedule to automate the execution of backup files.Assume we will full-backup weekly and differerntial-backup daily.
Now,that we have created a Task,we have to make sure it runs highest Privilege. we have to make sure that when you run the file it not should fail.