task scheduler and bach files running

Discussion in 'Microsoft Windows 2000 CMD Promt' started by ray.koerner@gmail.com, Sep 23, 2005.

  1. Guest

    I just finished writing a batch file that will psftp (secure ftp
    client) a file from a Linux machine to a windows machine, after the
    copy is complete it takes the log file that was created during the copy
    and it emails it to me via Blat, then takes the log file from one
    directory and copies it to another and renames it with the current
    date, and finally it emails me a dir command off the log file directory
    so that I can verify that the file was renamed to the current date. If
    I run this batch file from the command line it works perfectly, but as
    soon as I schedule it to run through the windows task scheduler it
    skips the psftp line. Anyone seen anything like this?
     
    , Sep 23, 2005
    #1
    1. Advertisements

  2. On 23 Sep 2005 07:46:02 -0700, "" <> wrote:

    >I just finished writing a batch file that will psftp (secure ftp
    >client) a file from a Linux machine to a windows machine, after the
    >copy is complete it takes the log file that was created during the copy
    >and it emails it to me via Blat, then takes the log file from one
    >directory and copies it to another and renames it with the current
    >date, and finally it emails me a dir command off the log file directory
    >so that I can verify that the file was renamed to the current date. If
    >I run this batch file from the command line it works perfectly, but as
    >soon as I schedule it to run through the windows task scheduler it
    >skips the psftp line. Anyone seen anything like this?



    Under what account is the job scheduled.
    Does that account have access to psftp or the credentials to log on or file system permissions or.....

    Jerold Schulman
    Windows Server MVP
    JSI, Inc.
    http://www.jsiinc.com
    http://www.jsifaq.com
     
    Jerold Schulman, Sep 23, 2005
    #2
    1. Advertisements

  3. Guest

    The job is currently scheduled to run under a domain admin account, but
    I have tried a local admin account and both did not work.
     
    , Sep 23, 2005
    #3
  4. On 23 Sep 2005 07:46:02 -0700, "" <> wrote:

    >I just finished writing a batch file that will psftp (secure ftp
    >client) a file from a Linux machine to a windows machine, after the
    >copy is complete it takes the log file that was created during the copy
    >and it emails it to me via Blat, then takes the log file from one
    >directory and copies it to another and renames it with the current
    >date, and finally it emails me a dir command off the log file directory
    >so that I can verify that the file was renamed to the current date. If
    >I run this batch file from the command line it works perfectly, but as
    >soon as I schedule it to run through the windows task scheduler it
    >skips the psftp line. Anyone seen anything like this?



    Is PSFTP installed for the Domain Admin account your are using?
    Any errors in the %SystemRoot%\Schedlgu.txt file?

    As a last resort, log on the computer that runs the task as the schedule user and log off.
    This will place a profile on the local computer that psftp might need (I don't know the product).


    Jerold Schulman
    Windows Server MVP
    JSI, Inc.
    http://www.jsiinc.com
    http://www.jsifaq.com
     
    Jerold Schulman, Sep 23, 2005
    #4
  5. Guest

    I am logged on with the user that is sceduled to run the task. No
    errors in the log. Everything looks like it completed normally.
     
    , Sep 23, 2005
    #5
  6. Re: Re: task scheduler and bach files running

    On 23 Sep 2005 08:43:33 -0700, "" <> wrote:

    >I am logged on with the user that is sceduled to run the task. No
    >errors in the log. Everything looks like it completed normally.



    ????????????????

    Cause the job to log everything

    If the job is:

    @echo off
    setlocal
    cmd1
    cmd2
    endlocal


    change it to

    @echo off
    setlocal
    call :logit>>C:\logit.log 2>>&1
    endlocal
    goto :EOF
    :logit
    cmd1
    cmd2

    and then inspect the C:\logit.log file.


    Jerold Schulman
    Windows Server MVP
    JSI, Inc.
    http://www.jsiinc.com
    http://www.jsifaq.com
     
    Jerold Schulman, Sep 24, 2005
    #6
  7. NayJo Guest

    I don't really understand the security settings involved but when I ran into
    this situation myself I had to schedule an exe that I wrote to run my batch.

    That exe was written with VC 6.0 and retrieved a security descriptor then
    called CreaterProcessAsUser() to run the batch.

    It seems as if running cmd from scheduler does not pass security credentials
    to cmd.exe.

    J
    <> wrote in message
    news:...
    > I am logged on with the user that is sceduled to run the task. No
    > errors in the log. Everything looks like it completed normally.
    >
     
    NayJo, Sep 28, 2005
    #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.