0xC0000142 Errors from Tasks in Windows Task Scheduler

JGarcia 6 Reputation points
2021-04-23T12:47:38.537+00:00

I previously had many C++ .exe programs (developed with C++ Builder XE7) running as scheduled tasks in a Windows 2008 R2 Datacenter server. These tasks were being run by the SYSTEM account and I never had any issues with them before.

I recently imported these tasks to a new Windows 2019 Datacenter server and set these tasks up in the Task Scheduler. The same SYSTEM account is being used to run the tasks, but with the updated Windows Server, these tasks now give me a run result of 0xC0000142.

Most of the resources I found online say to increase the desktop heap size in the registry editor - I have done this multiple times and restarted the server after each increase, but I was still getting the same results with this method so I reset the desktop heap size back to the original value.

I also thought it had to do with missing C++ redistributables - the new server only had redistributables from 2015-2019, while the 2008 R2 server had these along with redistributables from 2013 and 2008. So I installed these extra redistributables but I still got the same result.

I have tried manually recreating the tasks, I tried running the tasks with different domain admin accounts, also played around with the "run only when user is logged in/run whether user is logged in or not" setting. All of these led to the same 0xC0000142 error.

Also, there were no errors being shown in Windows Task Scheduler history or in the Event Viewer.

I tried monitoring the task with Process Monitor, below is a snippet of the log output leading up to the exit code. I know that error code 0xC0000142 is STATUS_DLL_INIT_FAILED. Right before the failure, tzres.dll.mui and tzres.dll are the last files accessed. There are no failure messages with these files other than the FILE LOCKED WITH ONLY READERS - I believe this is for read-only access, but these files are also read-only access on the old server where the tasks are working...

90698-procmonlog.png

Windows for business Windows Server User experience Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 60,161 Reputation points
    2021-04-23T14:22:27.213+00:00

    Can you run the program directly and it works? If it works then it isn't an issue with dependencies.

    I cannot really read your image so I cannot say what is going on there. I know nothing about C++ Builder so I cannot answer to its dependencies but, again, if the app runs outside TS then it isn't a dependency issue. Until the app runs outside TS then it won't run inside TS.


  2. Leila Kong 3,706 Reputation points
    2021-04-26T09:14:57.873+00:00

    Hello @JGarcia ,

    Is there any update on your side? We're looking forward to your good news.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.