Dynamically create Schedules with SMA

If you have done any work with SMA you will realize that the capabilities with scheduling are somewhat limited if you want to do a recurring schedule.  In fact, the only option for a recurring schedule is to run a particular runbook on a daily basis.

I recently worked on a project where we needed to execute a runbook every ten minutes.  Since they wasn’t a way to do that through the default user interface I had to get a bit creative by creating schedules dynamically through the runbook itself.  The following runbook/PowerShell workflow demonstrates how this might work.


workflow Scheduletest
{
write-output "hello world"
$TenMinutes = InlineScript
{
(get-date).AddMinutes(10)
}
$RemoveScheduleName = "TestSchedule1"
Remove-SMASchedule -Name $RemoveScheduleName -WebServiceEndpoint "https://smaserver" -Port 9090 -force
Set-SMASchedule -Name $ScheduleName -ScheduleType "OneTimeSchedule" -StartTime $TenMinutes -ExpiryTime $TenMinutes -WebServiceEndpoint "https://smaserver" -Port 9090
start-smarunbook -Name Scheduletest -ScheduleName $ScheduleName -WebServiceEndpoint "https://smaserver" -Port 9090
}

 

In this example I am dynamically creating a schedule called TestSchedule1 and then calling my runbook with that schedule all from within the runbook itself. If you get creative with this, you could dynamically set schedules based on the results of execution of other items within the runbook itself.

Happy automating!

By |2016-04-12T11:06:03+00:00July 1st, 2015|SMA|0 Comments

About the Author:

steve bowman

Model Technology

Let us help you get your end point and data center strategy on cruise control!  Ask about our Calibration Assessment.

CONTACT US

  • 12125 Woodcrest Executive Drive, Ste. 204 Creve Coeur, MO 63141
  • (314) 254-4138
  • sales@model-technology.com

RECENT TWEETS