Run batch file on remote server

Discussion in 'Windows Server' started by PeteL, Sep 24, 2007.

  1. PeteL

    PeteL Guest

    Overview: two servers running as cluster with the scheduled task clustered so
    if one server goes down the other will still run scheduled tasks.

    Problem: To do this the 'scheduled tasks' service is set to manual and only
    runs on the active server, if primary server fails then cluster starts
    scheduled service on secondary server once it becomes primary server. This
    means that I can't run a scheduled task to backup the system state on the
    secondary server.

    Question: Is it possible create a scheduled task on the primary server which
    will run a batch file as if it has been called from the secondary server?

    Thanks in advance, apologies for lengthy text.

    Pete.
     
    PeteL, Sep 24, 2007
    #1
    1. Advertisements

  2. Sure is. Use psexec.exe (www.sysinternals.com) to run this command
    on the other server:

    net start "Task Scheduler"
     
    Pegasus \(MVP\), Sep 24, 2007
    #2
    1. Advertisements

  3. PeteL

    PeteL Guest

    Pegasus

    Thanks for the response.

    I ran a few tests, and the problem seems to be that the cluster takes
    control of the 'Task Scheduler' service, and will not allow it to be started
    on the secondary server. This means I get an 'access denied' message when
    trying to use PSEXEC against the secondary server as it is unable to use the
    'Task Scheduler' service. I tested this by failing the cluster over, I was
    then unable to backup the server which was giving me the 'access denied'
    message

    These tools are a great find though, thanks.

    Any other ideas greatly appreciated.

    Pete.
     
    PeteL, Sep 25, 2007
    #3
  4. It is more likely that you used credentials that were not up to
    the job at hand. Try something like this instead:

    psexec -u PeteL -p SomePassword cmd
    net start "Task Scheduler"

    You should also execute the "net start" command while physically
    sitting in front of the server rather than at the remote machine.

    What does the Task Scheduler report about this problem?
     
    Pegasus \(MVP\), Sep 25, 2007
    #4
  5. PeteL

    PeteL Guest

    Pegasus

    Thanks for the response.

    Just to give you a bit of background; the following link shows the steps I
    followed
    http://msmvps.com/blogs/clustering/...ed-task-with-a-windows-2000-2003-cluster.aspx

    If I logon to the secondary server and attempt to start the 'Task Scheduler'
    I get an access denied message (logged on as administrator), If I move the
    cluster group to the secondary server the 'Task Scheduler' starts and I am
    then unable to start the 'Task Scheduler' on what was the primary server.

    This I guess makes sense from a cluster point of view or the tasks could end
    up being run from both servers at the same time.

    Thanks for your help so far.

    Pete.
     
    PeteL, Sep 25, 2007
    #5
  6. Sorry, I am getting way out my depth. One thing I note is that
    the the article you quote deals with the question of how to create
    a scheduled task on the active node in a cluster. It does not deal
    with the question of how to start the Task Scheduler service. Since
    I do not have a cluster to play with right now, I am unable to
    assist any further. If you really get stuck then you should ring
    Microsoft in your country and pay for a support call. The charge
    is quite moderate.
     
    Pegasus \(MVP\), Sep 25, 2007
    #6
  7. PeteL

    PeteL Guest

    Thanks Pegasus, your time was greatly appreciated.

    Pete.
     
    PeteL, Sep 25, 2007
    #7
    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.