Task Scheduler not running .bat or .vbs successfully
- by Django Reinhardt
Hi there, got this weird problem, which will hopefully have an obvious solution for some enlightened soul: We have several daily tasks we run via a .vbs script on our server (through the Task Scheduler), and for months it has been fine, but recently we've hit a problem. The .vbs script stopped successfully executing... but oddly it worked fine when ran manually!
The error given in these circumstances was always "Timeout".
We thought we try a little creative thinking, and run the .vbs another way: Via a .bat file. Again we hit weird issues, but with a little more debugging information, this time around.
The .bat file is nothing more than...
CScript "C:\location\script.vbs" > Log.txt
But the Task Scheduler fails with the following error:
0x1: An incorrect function was called or an unknown function was called.
The log.txt file says:
CScript Error: Initialization of the Windows Script Host failed. (Not enough storage is available to process this command. )
But get this: The .bat file executes perfectly (vbs script and all) if it's executed with a double click! There's only a problem when it's run by Task Scheduler. What the hell?
We're running Windows Server 2008 R2 (x64) and yes, the Task Sheduler's results are the same whether the user is logged in or not. Also, the user that can run the scripts successfully manually, is also the same user that runs the scripts in Task Scheduler.
Thanks for any help for this weird problem!