Hello there,
Can you run the program directly and it works? If it works then it isn't an issue with dependencies.
Windows Task Scheduler fails to run in batch mode when the machine has run out of non-interactive desktop heap space. Rebooting the server may rectify the temporary problem until the desktop heap is again exhausted. Adjusting the size of the non-interactive desktop heap has been known to resolve this error permanently.
If this problem is more urgent for you I would recommend that you can open a case to Microsoft for further professional help.
https://support.microsoft.com/en-us/help/4341255/support-for-busines
---------------------------------------------------------------------------------------------------------------------------------
--If the reply is helpful, please Upvote and Accept it as an answer–