Why are scripts failing with errors?

KB#:  KKB000679


Scripts fail with an error similar to:

ERROR: execFile() timed out waiting for C:\windows\system32\cmd.exe to complete.

appearing in the script log.

The script is taking longer than the default timeout of two hours to complete.

This could be one of two possible issues:

a) The script is waiting on user input, has insufficient rights, or is otherwise pausing before completing correctly.

b) The script takes longer than the default of two hours to run.



Diagnose why the script is taking longer than two hours to run.

The script may require that the user be logged onto the machine to respond to user input. You should change the IF- condition of the script to ensure that the user is logged in, or modify the script so that user input is no longer required.

The script may require that the correct credentials are bound to it in order to execute.

The script actions may take longer than two hours to complete. In this instance, break down the script into sub scripts, each of which takes less than two hours to complete, and then run the scripts in sequence, checking that each script has completed before initiating the next script.

The script may be waiting on a resource that is never freed correctly, such as a file being closed in order to write to it. You should check within the script logic whether the resource is free and have the script fail in the event that the resource is in use.

The script runs synchronously, and may be able to run asynchronously by launching separate processes to complete script actions. In this instance, you should subdivide the script up, and wait on completion of the asynchronous processes before running the next script.



It is possible to modify the two hour timeoutvalue, but you must configure this directly in the Kaseya server DB. The db field is "serverInfo.execTaskTimeoutSec". If NULL, then the default is 7200 seconds (i.e. 2 hours). You may configure this to a larger value, i.e. 14400.

This value is read when the kserver is restarted.

Note that increasing this timeout value will increase the time that the Kaseya agent waits before ending a script which is non-responsive for any of the other reasons listed above. For this reason, you should only modify this value in exceptional circumstances.



Scripts Tab
Script Log


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Article is closed for comments.