Getting Started with SQL Job Schedules

, ,

Getting Started with SQL Job Schedules

Getting Started with SQL Job Schedules, I recently suggested to a friend that they use Ola Hallengren’s SQL Server Maintenance Solution for their Config Manager database. I first heard of Ola’s scripts at the Midwest Management Summit. If you are not familiar with his scripts, you can find them here, Ola’s scripts automatically create several jobs for backup and other maintenance tasks but does not create or assign those jobs to a schedule.

Since my friend did not have much SQL experience, I created a quick overview of the scheduling process for them. If you are not familiar with SQL (which if you are still reading, is probably a fair assumption) scheduling jobs is a 2-step process. First, you need to create a schedule. Then you need to assign a job to the schedule that you created.


At this point, I will assume that you have configured and installed Ola’s scripts or have another SQL job that you need to schedule. Run SQL Server Management Studio, expand SQL Server Agent and then expand Jobs.

 Getting Started

1. Right click on Jobs and then click Manage Schedules.

Manage Schedule

2. Left click on New… in Manage Schedules

New Schedule

3. Type a name for the New Job Schedule. Since I am creating a schedule for a specific job on a single server, I am using the job’s name for the schedule. In a larger environment, you may consider using names that are more descriptive of the schedule since multiple jobs can be attached to each schedule.

Name Schedule

4. Configure the schedule. In this example, I am setting the schedule to every Sunday morning at 12:15am.

Configure Schedule

5. When you have completed editing the schedule, click OK to save it.

Save Schedule

6. Find the schedule that you just created and click on the ‘0’ in the right-most column.

Select Schedule

7. Select the job or jobs that you would like to assign to the schedule.

Select Jobs

8. Click OK in Jobs Referencing a Schedule. Click OK in Manage Schedules.

Save Scheduled Jobs

9. Right click on Job Activity Monitor. Click on View Job Activity.

Job Activity Monitor

10. Verify that the job is scheduled to run. In this case the Next Run for the Full Backup is Sunday at 12:15am. Click Close ad exit SQL Server Management Studio.

Verify Next Run

I hope this points you in the right direction for scheduling jobs in SQL Server. For more information on SQL Server scheduling, see Microsoft’s documentation at:


Adjusting the ConfigMgr Script Execution Timeout (pre 1810)

, , , , ,

In ConfigMgr, scripts that execute default to having an execution timeout of 60 seconds.  Normally this timeout is fine but you may run into situations where scripts run long and clients start receiving the following error in DcmWmiProvider.log.

In-line script execution time-out…
Failed to process CScriptProvider::PutInstanceAsync.
The script execution has timed out. (Error: 87D00321; Source: CCM)

ConfigMgr 1810 introduced the option to set the script timeout, if you are not up to 1810 yet and need to adjust the timeout then you are in the right place.  User raphael at posted a blog on how to adjust the timeout, this is a good script for a single site infrastructure but the client setting does not flow down from a CAS to primary sites.  For this reason I adapted his original script to handle a multi-level site hierarchy.  Update the variables at the top of the script as required and run it to set the script execution timeout.

$SiteCode = "CM1"
$SiteServer = ""
$ScriptTimeout = 120
$CCMAgents = (gwmi -Namespace root\sms\site_$SiteCode -Class SMS_SCI_ClientComp -ComputerName $SiteServer | where {$_.ClientComponentName -eq 'Configuration Management Agent'})
foreach ($CCMAgent in $CCMAgents)
    $props = $CCMAgent.Props
    for ($i = 0; $i -lt $props.count; $i++)
        if ($props[$i].PropertyName -eq "ScriptExecutionTimeout")
            $props[$i].Value = $ScriptTimeout
    $CCMAgent.Props = $Props
ALSO CHECK : Co-management - Multiple Pilot Policies