A majority of these calls stem from customers running custom scripts (.bat, .cmd, .vbs, powershell) or programs that seem to start, but never complete. Unfortunately, Task Scheduler does not capture errors thrown by these scripts/programs. It does however, capture errors, but of the Task Scheduler Engine itself.
To quickly test whether Task Scheduler is working right, you can do any of the following steps:
Notepad.exe or Calc.exe
1. Create a new task that launches notepad.exe or calc.exe
2. When they launch, confirm if they are running by checking the Processes tab in Windows Task Manager
3. You can also add the User Name column to see what user account it is running under
4. Close notepad.exe or calc.exe via the GUI or kill it in Windows Task Manager
Simple batch script
1. Create a file called test.cmd on the root of your C: drive (c:test.cmd)
NOTE – you must have admin rights to write to the root of C: - if not, adjust your script accordingly
2. Add the following lines to this file:
@ECHO OFF
C:
CD
ECHO %DATE% %TIME% >> C:list.txt
ECHO. >> C:list.txt
DIR C: >> C:list.txt
EXIT
3. Now save the file
4. Create a new task that launches c:test.cmd
5. Launch your task then check the C:list.txt file to confirm that it ran
PowerShell script
1. Create a file called test.ps1 on the root of your C: drive (c:test.ps1)
NOTE
– you must have admin rights to write to the root of C: - if not, adjust your script accordingly to point to a location you do have permissions to.
2. Add the following lines to this file:
PS | out-file c:list.txt
EXIT
3. Now save this file
4. Create a new task that launches powershell.exe with the optional argument of C:test.ps1
5. Launch your task then check the C:list.xt file to confirm that it ran
If needed, you can add multiple outputs in your scripts to see when/where they might be failing. You can be creative in your outputs which can lead you to the exact problem that is preventing your task from running.
Until next time, take care!
Additional Resources:
Troubleshooting Task Scheduler
-Blake Morrison