WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Miscellaneous

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Windows 2000 Task Scheduler Problem


Question:

I need to create a scheduled task that will send keystrokes and mouse movements on my windows 2000 system. However I am having problems getting it to execute. Can you help?

Answer:

I recommend adding DebugTrace(@on,'trace.txt') to the beginning of the script. This will help determine if the script is getting launched, and where exactly it is failing.

You might also want to tell the script to error out siliently. This can be accomplished using IntControl(38,1,'errorlog.txt',0,0). In "quiet mode" no error messages are displayed. If an error log filename is specified, then error messages will be written to that file.

Make sure you have a fully debugged and compiled EXE. When adding a new task to the Task Scheduler, you will want to pass it the fully qualified path of the compiled script.

Next make sure you are specifying the LOCAL SYSTEM (NT AUTHORITY\SYSTEM) account. The task must be run under the Local System account if the script is going to require desktop access. The Sendkey and Mouse commands require access to the desktop. So when prompted for an account name specify 'SYSTEM', and leave the passwords blank.

User Reply:

Ok. I am now specifying the SYSTEM account for my scheduled task. However the trace.txt and the errorlog.txt are not getting generated. In the Task Scheduler dialog under 'Status' it claims 'Could not start'.

Under the 'Advanced|View log' menu it shows:

"test3.job" (test3.exe) 1/19/2006 11:47:57 AM ** ERROR **

            The attempt to log on to the account associated with the task failed, therefore, the task did not run.

            The specific error is:

            0x8007052e: Logon failure: unknown user name or bad password.

            Verify that the task's Run-as name and password are valid and try again.

Answer:

I think I found the reason for the problem we are having on the Windows 2000 system. The following Microsoft article explains:

http://support.microsoft.com/?scid=843281

SYMPTOMS

When you use the Scheduled Task Wizard on a Microsoft Windows 2000-based computer to schedule a task that the local 
system account runs, the scheduled task may not occur. Also, when you click View Log on the Advanced menu in Scheduled 
Tasks, an error message that is similar to one of the following may be logged in the Schedlgu.txt file: 

0x8007052e: Logon failure: unknown user name or bad password.
Verify that the task's Run-as name and password are valid and try again.

0x80041314: ( SCHED_E_UNSUPPORTED_ACCOUNT_OPTION

RESOLUTION

Hotfix information
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that this article describes. 
Apply it only to systems that are experiencing this specific problem. To resolve this problem, contact Microsoft Product Support 
Services to obtain the hotfix. 
I would highly recommend getting this hotfix. You could try scheduling the service from the AT command line instead, however you might run into the same problems.

Goto the Start|Run Menu then type:

AT 10:30 /interactive "c:\temp\a.exe"
Note: you should see a new scheduled task appear in the ‘Scheduled task’ window in the control panel.

Reference:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/at.mspx


Article ID:   W17049
File Created: 2007:07:03:14:27:54
Last Updated: 2007:07:03:14:27:54