Task Scheduler: Running a task using the Local System Account

I am developing a batch interface to the NT Task Scheduler service using
VC++ 6. I have not been successful in getting scheduled tasks to run under
the Local System Account.

The error returned in schedlog.txt is:

“jsw2.job” (test2.bat) 3/6/01 4:44:00 PM ** ERROR **
The attempt to log on to the account associated with the task
failed, therefore,
the task did not run.
The specific error is:
0x80070057: The parameter is incorrect.
Verify that the task’s Run-as name and password are valid and try
again.

According to the documentation for
IScheduledWorkItem::SetAccountInformation, I can specify the Local System
Account by executing:
SetAccountInformation(L"", NULL)
This call succeeds, but the task reports the above error.

The task will run if I add my userid and password to the task, so I do not
suspect any of the other task parameters.

Any hints would be approved.

Thanks,
Joe Wagner


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi,

I had faced the same problem. But I do not remember the exact solution.
But if i am not wrong try setting this falf using the SetFlags method.
TASK_FLAG_RUN_ONLY_IF_LOGGED_ON
I guess it should work.

Regards,
Santhosh


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Santhosh,

I tried setting this flag, along with the same values in SetAccountInfo
(L"", NULL). Unfortunately, the result was the same.

I also upgraded my Platform SDK as part of this process.

Thanks,
Joe


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com