Today i’ve been trying to understand why I couldn’t configure a scheduled task to run a Sitecore Powershell script. I found many useful articles which explained the configuration options for Sitecore scheduled tasks.
One notable detailed article can be found on the Sitecore Community Docs which reconfirmed my understanding of what triggers the scheduled tasks to run and how often the agent checks what tasks to be run.
I played around with these settings and still couldn’t get my scheduled task to run. I then read a post on stack overflow which gave me a good pointer.
I needed to check that the database agent was being initialised correctly, where you should see the following towards the start of the Sitecore logs:
9988 17:25:38 INFO Scheduler - Adding agents
So i then looked back through my logs to see when this was last logged. I then looked at the tail of the file to see which configuration file was added or changed.
I found that i had added “Include/zzz/InitializeSpeedBooster.config” to speed up the startup of Sitecore. This is an optional config when creating a new Sitecore instance using Sitecore SIM.
I opened this config and spotted the issue straight away. To fix the issue but using the other speed boosting configuration, you can comment out the following line:
<processor type="Sitecore.Pipelines.Loader.InitializeScheduler, Sitecore.Kernel">
This resolved my issue and now all Sitecore scheduled tasks and scheduled Powershell scripts now run, as per the schedule configuration.
I hope this post will save someone else with the same scenario some time in resolving.