Different schedules for weekday vs weekend for Veeam backup jobs

Posted on Updated on

Excellent writeup on having different schedules for weekday vs weekend for Veeam backup jobs



by cffit on veeam forums


It takes some time to setup, but after that it should work ongoing with minimal effort. However, I’m still frustrated this isn’t in the GUI as things that run as scripts and scheduled tasks tend to get forgotten about when changes are made.

VEEAM B&R installs the VEEAM PowerShell snap-in so you don’t have to do anything to get that. You can access it by going into the B&R software and clicking on the blue box with the dropdown arrow in the top left and choosing PowerShell.

I used the service account for VEEAM B&R to create the scheduled tasks and run the PowerShell scripts. For me, this account is a local admin on the server. If yours isn’t, you might have to adjust as necessary.

I created two text files named something like “WeekdayScheduleChange.txt” and “WeekendScheduleChange.txt”. I then edited them to read like this..

The WeekdayScheduleChange.txt file looks like this:

Add-PSSnapin VeeamPSSnapin
Set-VBRJobSchedule -Job "Exact_Name_of_Backup_Job01" -At "17:00" -Daily -DailyKind Weekdays
Set-VBRJobSchedule -Job "Exact_Name_of_Backup_Job02" -At "17:15" -Daily -DailyKind Weekdays
Set-VBRJobSchedule -Job "Exact_Name_of_Backup_Job03" -At "17:30" -Daily -DailyKind Weekdays
Set-VBRJobSchedule -Job "Exact_Name_of_Backup_Job04" -At "18:00" -Daily -DailyKind Weekdays

The WekendScheduleChange.txt file looks like this:

Add-PSSnapin VeeamPSSnapin
Set-VBRJobSchedule -Job "Exact_Name_of_Backup_Job01" -At "4:00" -Daily -DailyKind SelectedDays -Days Saturday
Set-VBRJobSchedule -Job "Exact_Name_of_Backup_Job02" -At "6:30" -Daily -DailyKind SelectedDays -Days Saturday
Set-VBRJobSchedule -Job "Exact_Name_of_Backup_Job03" -At "10:00" -Daily -DailyKind SelectedDays -Days Saturday
Set-VBRJobSchedule -Job "Exact_Name_of_Backup_Job04" -At "14:00" -Daily -DailyKind SelectedDays -Days Saturday

Obviously change the name of the backup jobs to what yours are named, exactly. Rename both files from .txt to .ps1

Setup two scheduled tasks, one to run each one of these files. I run the WeekendScheduleChange.ps1 script at 2AM Saturday morning and the WeekdayScheduleChange.ps1 script at noon on Monday.

In order to setup scheduled tasks to run PowerShell scripts there are a few ways to do this. I set the task to run as the VEEAM service account (which is a local admin). I set it to run whether logged in or not and to use highest privileges and also configure for the version of Windows I’m using. The trigger is the schedule which I mention a few lines above. For the Action, I find it’s easiest to create a new action of “Start a program” and then for Program/script I enter “powershell” (without quotes) and then under “Add arguments” I enter “-file C:\PathToScript\WeekendScheduleChange.ps1” (again without the quotes). If your path has spaces in it you will need to put quotes around the path only like -file “C:\PathToScript\WeekendScheduleChange.ps1”. That’s all I set. Enter the password for the account you are using for the task and you are good. I then tested by right clicking the task and running it.

Doing this will in essence just change the job schedule within the job. All the other parts of the job will remain the same such as whatever day you set for the full backup and methods. It only changes the checkmarks/time on the scheduling section. This way you can still have all your options set in the GUI and ONLY change when the job runs. I didn’t want to have to specify all the job options via PowerShell as I’m not super great with PowerShell and the VEEAM syntax added in makes it even more of a challenge for me.

Hope this makes sense and helps some people out. When I realized v9 wasn’t going to resolve this for me, I decided to put the time into figuring out how to do it with PowerShell.

Thanks to Tom and Vladimir from VEEAM for helping me with the syntax of PowerShell. Good luck everyone!


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 )

Facebook photo

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

Connecting to %s