Moodle has a cron.php script that takes care of routine tasks, such as unsubscribing inactive members from classes and sending out email messages. Unfortunately, there is no built-in way for this script to run every few minutes when the Moodle installation is inside a protected directory, such as a school Intranet. However, I figured out a workaround.
If you have directory security enabled on your IIS Moodle installation, don’t use MoodleCron. Instead create a Windows Scheduled Task on your server. This passes credentials and executes the cron.php script from the command line, getting around nasty browser authentication issues.
1. Open Control Panel –> Scheduled Tasks on your server
2. Open Add Scheduled Task. Select Next.
3. When asked to select an application, Browse to your PHP installation and select PHP.exe. Select Next.
4. Create a name for the task (I called mine “Moodle cron”)
5. Perform this task “daily.” Select Next.
6. Perform this task “every day” (leave the other items on defaults). Select Next.
7. Enter the name and password of a user who has directory privileges on your /moodle/admin folder. Select Next.
8. Select “Open advanced properties for this task when I click Finish.” Select Finish.
9. Under the Task tab, append the location of cron.php to the Run field, e.g. c:\php\php.exe d:\webroot\moodle\admin\cron.php
10. Under the Schedule tab, click Advanced and then select Repeat Task in order to make the task run more often than once per day. I set mine to run every ten minutes. Select Apply.
11. Select OK. You’re done! Check the Event log later to ensure that the script is not returning errors.