Sometimes you have a task that you want to run every x minutes i.e. updating order statuses or sending abandoned cart emails. There are a few ways you can do this but our preferred method at The Site Doctor is to setup a Powershell Task in Windows Task Scheduler as we’ve found this is the most reliable solution. It’s also surprisingly simple:

1. Open up Task Scheduler

2. Click “Create Task”

3. Enter a meaningful name i.e. “Change Order Status” [1] and ensure that it runs whether you’re logged in or not [2] (you will need to enter your username and password on save)

4. Create a new Trigger (under the Triggers Tab)

5. Set the trigger to run “Daily” [1], start at some point in the future [2], repeat every “5 minutes” [3]. Pro Tip: Did you know you can change this to “1 minute” if you want by typing it in? Set it to repeat for a duration of “Indefinitely” [4]

6. Click the “OK” button

7. Click the “Actions” tab and create a new action

8. Type “powershell” into the “Program/script” box [1] and then “-ExecutionPolicy unrestricted -Command “(New-Object Net.WebClient).DownloadString(\”http://www.YourUrlHere.com\“)”” into the “Add arguments” [2] box (changing the URL to whatever it is you need to hit)

9. Click the “OK” button to return to the “Actions” window

10. Click the “OK” button to save and close the Task window

That’ll now mean that task runs every day at 5 minute intervals as long as the computer is on until you disable it.

Know a better way? Let me know!

p.s. if you’re using Umbraco scheduling functionality is somewhat built in but we’ve found it to be hit and miss and it also seems to run on the user’s request thread which can block them -or worse, only run when someone is on your website…