SBS 2011 Some scheduled tasks result in 0x2 Access Denied errors

Created some tasks, as I have done hundreds of times in the past.
These tasks all result in 0x2 when they are run, etiher by running manually or by the schedule.
I try setting them to run as SYSTEM and I have tried domain administrator.  Neither has any effect.
They still exit with 0x2 result code.
However, I have some other tasks that run just fine.
I have tried to copy their settings - everything except the actual cmd file they are running - and the new tasks fail with a 0x2 result.

I have tried resetting the NTFS perms on the %windir%\Tasks folder,

I am quickly running out of ideas.  This is killing me.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Muhammad BurhanManager I.T.Commented:
The Task Scheduler in executes tasks under a "least privileges" security context by default.

Open the properties of the task and check Run with highest privileges. Press OK, then enter the password for the administrative account when prompted. This will override the default "least privileges" behavior and will allow the task to run with administrative privileges.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Digital_SkreamAuthor Commented:
I did that already.  It didn't fix it.
Muhammad BurhanManager I.T.Commented:
Clear the logs and then run that task, lets see whats in there after you run task
Digital_SkreamAuthor Commented:
Just discovered that task scheduler reports the errorlevel returned by the program which it is running.
just as if I had typed echo %errorlevel%

I had always thought it was returning an error code based on some internal functionality of Task Scheduler itself, much like an Event ID.

This led me to an error in the script, which was easily fixed.
I will award shared points to the first response, as that will probably help someone else.
Shared, because this errorlevel information might also help someone in the future.
Digital_SkreamAuthor Commented:
The solution was the discovery of ERRORLEVEL information, which i had not found documented anywhere else.
however, the first comment would have been helpful in another situation.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.