Forum Discussion
Task Scheduler on Windows Server - 0x2 error
This is where monitoring with Process Monitor (procmon from SysInternals - now operated by Microsoft) would provide real clarity.
But I have seen a similar, very rare issue before albeit in a different context to what you're doing with net.exe, so I'll throw this out there as an option to try (in the Hail Mary category.)
Try creating the following two directories:
- C:\windows\system32\config\systemprofile\desktop
- C:\windows\syswow64\config\systemprofile\desktop
You should create these from an administrative command prompt to avoid the additional permissions Windows Explorer adds, but to each their own.
At the end of the day, a file or directory is definitely missing, it's just a case of determining what it is. If you are game to give it a try, ProcMon (mentioned above) will answer that question for you.
Cheers,
Lain
Doesn't seem to have made any difference - task is still giving a 0x2.
Thanks
- LainRobertsonMay 26, 2022Silver Contributor
Yeah, fair enough - it was only an educated guess at best. Task Scheduler could be looking for anything (though probably something related to creating the session environment passed into the CreateProcess call.)
Within Process Monitor, you can configure a filter like the one shown below to find what is missing. There's not much value in me making further guesses on what the missing component might be.
Ideally, you want to:
- Set up the filter first while paused;
- Make sure the history has been cleared;
- Start the capture;
- Start the scheduled task;
- Stop the trace once complete (should only take seconds to fail);
- Check the results.
The only display filters you'd want to check out are the files and registry filters, and even then, possibly just one at a time if the number of returned rows is significant.
Process Monitor filter
Example results, also showing the display filters
Cheers,
Lain