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!

About the Author: 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.

Three Minutes For A More Secure & Efficient Infrastructure

Short and to the point, Steve’s Email Blasts give you endpoint management tips, tricks, and news in three minutes or less email read-time, guaranteed.

Model says no to spam. Privacy Policy

These Posts Might Be Helpful Too

Model Technology Solutions

Model Technology Solutions is a small but mighty band of infrastructure experts. We’ve helped companies in diverse industries to modernize and automate their infrastructures through effectively managing their Microsoft endpoint suite.

With us on your team, you’ll watch your security and compliance go up and your IT team’s costs (and headaches) go down. You’ll relax in knowing that your endpoints will be secure and online when your users need them most. And you’ll finally get back to your most-important tasks.

Model Technology Solutions
12125 Woodcrest Executive Drive, Ste. 204 Creve Coeur, MO 63141

Phone: (314) 254-4138
General Inquiries: model@model-technology.com
Sales and Quotes: sales@model-technology.com