I’ve been working on a PowerShell script that required to be automatically run every 5 minutes. As you probably guessed, using Windows Task Scheduler is the way to go.
Prior to assigning any scripts or programs to a scheduled task, I always run them manually first to ensure all issues are rectified. We all know if there is an issue whilst running within Task Scheduler, Windows likes to help us by showing us some ambiguous error/success codes.
Luckily, MSDN provides a comprehensive list of these codes that can be found here: http://msdn.microsoft.com/en-us/library/aa383604
But there more common codes are listed below:
0 or 0x0: The operation completed successfully.
1 or 0x1: Incorrect function called or unknown function called.
2 or 0x2: File not found.
10 or 0xa: The environment is incorrect.
0x41300: Task is ready to run at its next scheduled time.
0x41301: Task is currently running.
0x41302: Task is disabled.
0x41303: Task has not yet run.
0x41304: There are no more runs scheduled for this task.
0x41306: Task is terminated.
0x8004131F: An instance of this task is already running.
0x800704DD: The service is not available (is 'Run only when an user is logged on' checked?)
0xC000013A: The application terminated as a result of a CTRL+C.
0xC06D007E: Unknown software exception.