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
$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!