Task Scheduler not running .bat or .vbs successfully

Posted by Django Reinhardt on Server Fault See other posts from Server Fault or by Django Reinhardt
Published on 2010-05-31T11:24:14Z Indexed on 2010/05/31 11:34 UTC
Read the original article Hit count: 1016

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!

© Server Fault or respective owner

Related posts about windows-server-2008

Related posts about batch-file