Task Scheduler and Robocopy Batch Job

Discussion in 'Windows Vista General Discussion' started by bobneedshelp, Sep 9, 2007.

  1. bobneedshelp

    bobneedshelp Guest

    I would like to schedule Robocopy to copy files from my PC to an external
    hard drive. I have created a batch file that does this and it runs from the
    command line. This works well when I am logged in; however, I would like it
    to "Run whether user is logged on or not". I have tried setting it with
    "highest privileges"; however I can't get it to run in this mode.

    In the History tab, I see an Error with Error Value: 2147750687. The
    Operational Code is 6619136. It also has a Task Category of "Task Start
    Failed". I would guess this is security related. I have the task scheduled
    under an administrator account. The Logon as batch job is true for
    administrators.

    Any thoughts as to what I can try to get a simple Batch Job running with
    Task Scheduler so that it can run in the middle of the night?
     
    bobneedshelp, Sep 9, 2007
    #1
    1. Advertisements

  2. Hi Bob,

    Can you double-check that error code? I don't recognise "2147750687" as a
    well-known HRESULT. In fact, in that form it would be an informational
    message, not an error message (error HRESULTs are negative, usually in the
    form -214nnnnnn).

    If you double-click the Event on Event Viewer, it will appear in a dialogue
    box with a "Copy" button. You can then copy-n-paste the exact text of the
    event into a reply message.

    The Task Scheduler service writes a text log file as it runs, called
    C:\Windows\Tasks\SchedLGU.txt You might find some additional diagnostic
    information in this file (and if so, copy it to a reply mesage to the
    newsgroup).

    Once we have an HRESULT we can decode, that should give us a better idea of
    exactly what failed.

    Regards,
     
    Andrew McLaren, Sep 9, 2007
    #2
    1. Advertisements

  3. bobneedshelp

    Jon Guest



    I have a feeling that you have to schedule the 'run whether user is logged
    on or not' type tasks with the System account, rather than your own. You may
    wish to play with that suggestion.
     
    Jon, Sep 9, 2007
    #3
  4. bobneedshelp

    bobneedshelp Guest

    The log had no information in it about this task. Here is the exact error
    message that occurs. User "Bob" is the adminstrator.

    Log Name: Microsoft-Windows-TaskScheduler/Operational
    Source: Microsoft-Windows-TaskScheduler
    Date: 9/9/2007 6:01:00 PM
    Event ID: 101
    Task Category: Task Start Failed
    Level: Error
    Keywords:
    User: SYSTEM
    Computer: BlackComputer
    Description:
    Task Scheduler failed to start "\Bob Tasks\test task" task for user
    "BlackComputer\Bob". Additional Data: Error Value: 2147943645.
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
    <Provider Name="Microsoft-Windows-TaskScheduler"
    Guid="{de7b24ea-73c8-4a09-985d-5bdadcfa9017}" />
    <EventID>101</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>101</Task>
    <Opcode>101</Opcode>
    <Keywords>0x8000000000000000</Keywords>
    <TimeCreated SystemTime="2007-09-09T23:01:00.002Z" />
    <EventRecordID>380888</EventRecordID>
    <Correlation />
    <Execution ProcessID="1100" ThreadID="1620" />
    <Channel>Microsoft-Windows-TaskScheduler/Operational</Channel>
    <Computer>BlackComputer</Computer>
    <Security UserID="S-1-5-18" />
    </System>
    <EventData Name="TaskStartFailedEvent">
    <Data Name="TaskName">\Bob Tasks\test task</Data>
    <Data Name="UserContext">BlackComputer\Bob</Data>
    <Data Name="ResultCode">2147943645</Data>
    </EventData>
    </Event>
     
    bobneedshelp, Sep 10, 2007
    #4
  5. Ah, that looks better. 2147943645 is a standard Windows HRESULT, defined in
    Winerror.h:

    # as an HRESULT: Severity: FAILURE (1), FACILITY_WIN32 (0x7), Code 0x4dd
    # for decimal 1245 / hex 0x4dd
    ERROR_NOT_LOGGED_ON
    # The operation being requested was not performed because the
    # user has not logged on to the network.
    # The specified service does not exist.

    So, it looks like the Task was unable to run because its user context,
    BlackComputer\Bob, was not logged on. But, I guess you have the "Run whether
    the user is logged on or not" option selected. So it's still a bit
    perplexing ...
     
    Andrew McLaren, Sep 10, 2007
    #5
  6. I was experiencing this same problem triggering an access database with
    command line parameters.

    It turns out, after reading the posts here, that my problem was due to
    being logged on as a different user to the one I was trying to run the
    task as.

    I originally decided to have these tasks run as the domain
    administrator since I thought that was best for various permission
    reasons. However these tasks run, close to the end of the day, when I
    am still logged onto my machine and were returning the 2147750687 error
    code.

    Having changed the tasks to run using -my- user credentials (Or the
    user currently logged on) they now run fine.

    This may not help as you are trying to run over night and the PC is
    likely to be logged off anyway. If not I would suggest making sure the
    task is running as the currently logged on user and not someone else.

    Martin.
     
    MartinBannister, Nov 29, 2007
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.