Video Screencast Help

BE 2012 - Run Job At Certain Hourly Intervals Between Certain Hours Of The Day.

Created: 25 May 2012 • Updated: 17 May 2013 | 2 comments
pkh's picture
+2 2 Votes
Login to vote


I want to run my SQL log backup or increment backup job on the hour every x hour between 9 a.m. and 5 p.m. during the week-days.


BE 2010 or earlier

With BE 2010 or earlier versions of BE, this can be done with a combination of the restart interval and time window of the job property.  You set your job to start at 9 a.m. for each week-day.  The time window for the job would be 8 hours and the restart interval would be x hour.  This will cause the job to start every x hour on the hour from 9 a.m. to 5 p.m.

BE 2012

BE 2012 does not have restart interval.  To achieve the above scenario, you would use a combination of hourly recurrance and BEMCLI cmdlets.

1) Set up your SQL log backup or incremental backup job.

These jobs must be setup as part of a scheduled backup and the full backup must be done at least once.

The properties of these jobs must specify the hourly recurrance.  For example,

The above screenshot shows 2 hours, but you can change it to the interval that is required, like x hour.

If nothing else is done, then the above incremental backup job will run every x hour throughout the day everyday.  This is not what is needed.

2) Use BEMCLI to stop and resume the job

To restrict the SQL log backup or incremental job to run during the hours desired, you got to use the Windows Scheduler to schedule the BEMCLI cmdlets

Get-BEJob "incr-2" | Suspend-BEJob


Get-BEJob "incr-2" | Resume-BEJob

In our example, the Suspend-BEJob cmdlet needs to be scheduled for 5 p.m. for each week-day to stop the schedule and the Resume-BEJob cmdlet needs to be scheduled for 9 a.m. for each week-day to resume the schedule.
If you do not want to deal with the Windows Scheduler, you can define two full backup job which backs up a very small file to disk.  One job would have the Resume-BEJob cmdlet as either the pre-/post-command and would run at 9 a.m. each week-day.  The other job would have the Suspend-BEJob cmdlet as either the pre-/post-command and would run at 5 p.m. each week-day.
The proper syntax to use to code the cmdlet for the Windows Scheduler and as the pre-/post-command is given in my article
* EDIT *
If you do not want mess with BEMCLI and the Windows Scheduler, see the article below for an alternate way of setting up these jobs

Comments 2 CommentsJump to latest comment

RobRodrigues's picture

This is very beautifull but Be2012 shouldn't loose settings.

I've putted this in the idea area to be putted again in the be2012

Login to vote