Learn how to schedule an OMS Automation runbook


Summary: Learn how to schedule Automation runbooks to automate tasks.

Good morning everyone, Ed Wilson here, and today I want to talk about how to use the Automation schedule service from Microsoft Operations Management Suite. The advantages of scheduling the execution of a runbook is obvious -- I can have it execute whenever I want it to.

First, go to the automation portal and create a new schedule

The first thing I need to do is to go to the Automation portal. I can do this from my OMS home screen which is shown here.

Screenshot of the Automation portal.

I am then taken to the Microsoft Operations Management Suite Overview > Automation page. This page is shown here:

Screenshot of the Automation Overview page.

I click the Runbooks icon to go to the Microsoft Azure Runbooks page. This is shown here:

Screenshot of the Microsoft Azure Runbooks page.

On Tuesday, I created a PowerShell workflow runbook that was called StartAllV2Vms. On Wednesday, I created a PowerShell workflow runbook that was called StopAllV2Vms. What I want to do today is to create and link schedules for each of the runbooks. In this way, I will have all the virtual machines in a particular management group start up automatically and then shut down automatically. This is a great way to manage costs for my demo automation accounts.

Second, select the runbook to schedule

After I select my specific runbook, a management page opens. From here, I can choose to run, view, edit, delete, export, or schedule the runbook. This page is shown here:

Screenshot of a management page for a runbook.

I now select Schedules and the Schedules page opens. From here, I can add a new schedule. When I select Add a schedule, the options are to Link a schedule to your runbook or Modify run settings. What I want to do is to create a schedule and link the schedule to my runbook. So, I choose the first option. This page is shown here:

OMS-4-21-16-05

After I choose to link a schedule to my runbook, I go to the Schedule page. If I have previously created a schedule (perhaps one that is linked to a different runbook), I can simply select the schedule and link it to my runbook. If, however, I do not like the existing schedules, there's an option to create a new schedule. The new Schedule page is shown here:

Screenshot that shows schedules and an option to create a new schedule.

I need to give the schedule a unique name and a start time (in local time) for the runbook to run. I do not have to assign a description, but, from a management perspective, I highly recommend a useful description. You can also change the recurrence of the scheduled job. By default, it runs once. Other patterns are daily or even hourly. If I want something to run twice a day, I simply create a second schedule for time that I want the runbook to run the second time.

I repeat the procedure for my StopAllV2Vms runbook, and now I have an automatic startup and shutdown of my virtual machines.

Pretty cool.

You can get a free Microsoft Operations Management Suite (#MSOMS) subscription so that you can test the new alerting features. You can also get a free subscription for Microsoft Azure.

That is all I have for you today. Join me tomorrow when I’ll talk about checking on the results of the scheduled jobs.

I invite you to follow me on Twitter and the Microsoft OMS Facebook site. If you want to learn more about Windows PowerShell, visit the Hey, Scripting Guy Blog. If you have any questions, send email to me at scripter@microsoft.com. I wish you a wonderful day, and I’ll see you tomorrow.

Ed Wilson
Microsoft Operations Management Team

Comments (0)

Skip to main content