fbpx
Dynamically create Schedules with SMA
By Steve Bowman
Published July 1, 2015
Estimated Reading Time: < 1 minute

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!

Post Tags:
Article By Steve Bowman
Steve Bowman is a Partner at Model Technology as well as their Vice President of Sales and Marketing. Steve is a father, husband, Franciscan, and lover of technology. He's bilingual in business and technology and have over 30 years of experience in selling enterprise technology solutions in a variety of industries.

Related Posts

No Results Found

The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.

No Results Found

The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.

No Results Found

The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.