Results 1 to 5 of 5

Thread: Windows 2008 Scheduled Tasks

  1. #1
    Joe Grover Guest

    Windows 2008 Scheduled Tasks

    Man, I just don't know what it is that's so different in 2008 that's giving
    me such headaches with scheduled tasks.

    Since converting from a Windows 2003 server to 2008 for our file server I've
    had numerous problems with scheduled tasks no longer running. I've set them
    up as identically as I can tell (given the differences between the two task
    scheduler interfaces), running the same script files, and they just don't
    want to run on the 2008--but only as a scheduled task. If I run the .cmd
    from the command line it works fine.

    For example:

    I have a basic script (estimating.cmd) that uses the Windows copy command to
    copy two Excel documents from a departmental share to our intranet site.
    The script is as follows:

    Copy "C:\DATA\estimate\Resource Tools\HardBids.xls"
    "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup"
    Copy "C:\DATA\estimate\Resource Tools\CurrentEstimatLoad.xls"
    "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup"

    Both the file server (that the script is running on) and the intranet server
    are domain members, and the task is running using the domain administrator
    account. I've also tried checking the "Run with highest privileges" box.
    If I go to the command prompt, navigate to the scripts director and type
    "estimate.cmd", the script runs fine, both files are copied successfully.
    If I set this up as a scheduled task it fails with result 0x1. I am unable
    to determine what this error means for the copy command, and it just boggles
    my mind why it would fail in the first place, since running the script
    manually works without a problem.

    I've tried using the /Y switch in case whatever environment is running the
    script just doesn't like the fact that the file already exists at the
    destination. I've also tried adding > ppg.log at the end of the first line
    and >> ppg.log at the end of the second to record some sort of output, but
    no files were created.

    I welcome any advice, as I'm at my wit's end here. The other scripts I've
    just given up and ran them from the target, copying from the source to
    themselves, but I would like to nail down once and for all just what is so
    different about the Windows 2008 Task Scheduler that is causing every script
    I've ever used to not run without issue. Thanks in advance.

    Joe


  2. #2
    Pegasus \(MVP\) Guest

    Re: Windows 2008 Scheduled Tasks


    "Joe Grover" <grover.joe@acd.net> wrote in message
    news:eG2kdvHYJHA.4852@TK2MSFTNGP04.phx.gbl...
    > Man, I just don't know what it is that's so different in 2008 that's
    > giving me such headaches with scheduled tasks.
    >
    > Since converting from a Windows 2003 server to 2008 for our file server
    > I've had numerous problems with scheduled tasks no longer running. I've
    > set them up as identically as I can tell (given the differences between
    > the two task scheduler interfaces), running the same script files, and
    > they just don't want to run on the 2008--but only as a scheduled task. If
    > I run the .cmd from the command line it works fine.
    >
    > For example:
    >
    > I have a basic script (estimating.cmd) that uses the Windows copy command
    > to copy two Excel documents from a departmental share to our intranet
    > site. The script is as follows:
    >
    > Copy "C:\DATA\estimate\Resource Tools\HardBids.xls"
    > "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup"
    > Copy "C:\DATA\estimate\Resource Tools\CurrentEstimatLoad.xls"
    > "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup"
    >
    > Both the file server (that the script is running on) and the intranet
    > server are domain members, and the task is running using the domain
    > administrator account. I've also tried checking the "Run with highest
    > privileges" box. If I go to the command prompt, navigate to the scripts
    > director and type "estimate.cmd", the script runs fine, both files are
    > copied successfully. If I set this up as a scheduled task it fails with
    > result 0x1. I am unable to determine what this error means for the copy
    > command, and it just boggles my mind why it would fail in the first place,
    > since running the script manually works without a problem.
    >
    > I've tried using the /Y switch in case whatever environment is running the
    > script just doesn't like the fact that the file already exists at the
    > destination. I've also tried adding > ppg.log at the end of the first
    > line and >> ppg.log at the end of the second to record some sort of
    > output, but no files were created.
    >
    > I welcome any advice, as I'm at my wit's end here. The other scripts I've
    > just given up and ran them from the target, copying from the source to
    > themselves, but I would like to nail down once and for all just what is so
    > different about the Windows 2008 Task Scheduler that is causing every
    > script I've ever used to not run without issue. Thanks in advance.
    >
    > Joe


    Standard solution: Give yourself some eyes so that you can see what's going
    on. Here is the modified version of your batch file:

    @echo off
    echo %date% %time% %UserName% %ComputerName% >> c:\test.txt
    Copy /y "C:\DATA\estimate\Resource Tools\HardBids.xls"
    "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup" 1>>c:\test.txt
    2>>&1
    Copy /y "C:\DATA\estimate\Resource Tools\CurrentEstimatLoad.xls"
    "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup" 1>>c:\test.txt
    2>>&1
    echo %date% %time% End of task >> c:\test.txt

    Note that the /y switch belongs into the batch file if you want it to be
    robust, not into the environment.

    Now examine c:\test.txt and all will become clear.



  3. #3
    Joe Grover Guest

    Re: Windows 2008 Scheduled Tasks

    Well... um... It completed successfully. No error.

    However, thanks to me playing with the script you posted I think I've found
    the problem.

    Originally when I put your script in there I didn't edit it so the "2>>$1"
    command was on the same line as the Copy command, so the task failed with a
    new error (0xFF) and the text file only said "1 file copied", which was
    likely the log file. I changed it and ran it again and it completed
    successfully.

    I then went back into my original script and I saw that the second Copy
    command had a space at the end of the string. I started looking at other
    scripts I had problems with and found similar issues in those (these are not
    scripts I've created, just ones that have been running without issue on an
    older server for time beyond counting that I copied over to this new 2008
    machine). Apparently 2008 is less tolerant of these trailing spaces (at
    least when running at ask, as the scripts work fine if you just execute them
    manually).

    I deleted this trailing space, rescheduled the task to run and it completed
    successfully. Thanks!

    "Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
    news:uKWe%239HYJHA.2280@TK2MSFTNGP06.phx.gbl...
    >
    > "Joe Grover" <grover.joe@acd.net> wrote in message
    > news:eG2kdvHYJHA.4852@TK2MSFTNGP04.phx.gbl...
    >> Man, I just don't know what it is that's so different in 2008 that's
    >> giving me such headaches with scheduled tasks.
    >>
    >> Since converting from a Windows 2003 server to 2008 for our file server
    >> I've had numerous problems with scheduled tasks no longer running. I've
    >> set them up as identically as I can tell (given the differences between
    >> the two task scheduler interfaces), running the same script files, and
    >> they just don't want to run on the 2008--but only as a scheduled task.
    >> If I run the .cmd from the command line it works fine.
    >>
    >> For example:
    >>
    >> I have a basic script (estimating.cmd) that uses the Windows copy command
    >> to copy two Excel documents from a departmental share to our intranet
    >> site. The script is as follows:
    >>
    >> Copy "C:\DATA\estimate\Resource Tools\HardBids.xls"
    >> "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup"
    >> Copy "C:\DATA\estimate\Resource Tools\CurrentEstimatLoad.xls"
    >> "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup"
    >>
    >> Both the file server (that the script is running on) and the intranet
    >> server are domain members, and the task is running using the domain
    >> administrator account. I've also tried checking the "Run with highest
    >> privileges" box. If I go to the command prompt, navigate to the scripts
    >> director and type "estimate.cmd", the script runs fine, both files are
    >> copied successfully. If I set this up as a scheduled task it fails with
    >> result 0x1. I am unable to determine what this error means for the copy
    >> command, and it just boggles my mind why it would fail in the first
    >> place, since running the script manually works without a problem.
    >>
    >> I've tried using the /Y switch in case whatever environment is running
    >> the script just doesn't like the fact that the file already exists at the
    >> destination. I've also tried adding > ppg.log at the end of the first
    >> line and >> ppg.log at the end of the second to record some sort of
    >> output, but no files were created.
    >>
    >> I welcome any advice, as I'm at my wit's end here. The other scripts
    >> I've just given up and ran them from the target, copying from the source
    >> to themselves, but I would like to nail down once and for all just what
    >> is so different about the Windows 2008 Task Scheduler that is causing
    >> every script I've ever used to not run without issue. Thanks in advance.
    >>
    >> Joe

    >
    > Standard solution: Give yourself some eyes so that you can see what's
    > going on. Here is the modified version of your batch file:
    >
    > @echo off
    > echo %date% %time% %UserName% %ComputerName% >> c:\test.txt
    > Copy /y "C:\DATA\estimate\Resource Tools\HardBids.xls"
    > "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup" 1>>c:\test.txt
    > 2>>&1
    > Copy /y "C:\DATA\estimate\Resource Tools\CurrentEstimatLoad.xls"
    > "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup" 1>>c:\test.txt
    > 2>>&1
    > echo %date% %time% End of task >> c:\test.txt
    >
    > Note that the /y switch belongs into the batch file if you want it to be
    > robust, not into the environment.
    >
    > Now examine c:\test.txt and all will become clear.
    >



  4. #4
    Pegasus \(MVP\) Guest

    Re: Windows 2008 Scheduled Tasks

    Thanks for the feedback.

    By the way, I never wrote "2>>$1" - I wrote "2>>&1". The difference is
    crucial for the debugging effort and it would have highlighted the error
    caused by the trailing spaces. I should have warned you not to retype my
    code but to copy/paste it - it's much more efficient anyway!


    "Joe Grover" <grover.joe@acd.net> wrote in message
    news:OrE85jTYJHA.5476@TK2MSFTNGP03.phx.gbl...
    > Well... um... It completed successfully. No error.
    >
    > However, thanks to me playing with the script you posted I think I've
    > found the problem.
    >
    > Originally when I put your script in there I didn't edit it so the "2>>$1"
    > command was on the same line as the Copy command, so the task failed with
    > a new error (0xFF) and the text file only said "1 file copied", which was
    > likely the log file. I changed it and ran it again and it completed
    > successfully.
    >
    > I then went back into my original script and I saw that the second Copy
    > command had a space at the end of the string. I started looking at other
    > scripts I had problems with and found similar issues in those (these are
    > not scripts I've created, just ones that have been running without issue
    > on an older server for time beyond counting that I copied over to this new
    > 2008 machine). Apparently 2008 is less tolerant of these trailing spaces
    > (at least when running at ask, as the scripts work fine if you just
    > execute them manually).
    >
    > I deleted this trailing space, rescheduled the task to run and it
    > completed successfully. Thanks!
    >
    > "Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
    > news:uKWe%239HYJHA.2280@TK2MSFTNGP06.phx.gbl...
    >>
    >> "Joe Grover" <grover.joe@acd.net> wrote in message
    >> news:eG2kdvHYJHA.4852@TK2MSFTNGP04.phx.gbl...
    >>> Man, I just don't know what it is that's so different in 2008 that's
    >>> giving me such headaches with scheduled tasks.
    >>>
    >>> Since converting from a Windows 2003 server to 2008 for our file server
    >>> I've had numerous problems with scheduled tasks no longer running. I've
    >>> set them up as identically as I can tell (given the differences between
    >>> the two task scheduler interfaces), running the same script files, and
    >>> they just don't want to run on the 2008--but only as a scheduled task.
    >>> If I run the .cmd from the command line it works fine.
    >>>
    >>> For example:
    >>>
    >>> I have a basic script (estimating.cmd) that uses the Windows copy
    >>> command to copy two Excel documents from a departmental share to our
    >>> intranet site. The script is as follows:
    >>>
    >>> Copy "C:\DATA\estimate\Resource Tools\HardBids.xls"
    >>> "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup"
    >>> Copy "C:\DATA\estimate\Resource Tools\CurrentEstimatLoad.xls"
    >>> "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup"
    >>>
    >>> Both the file server (that the script is running on) and the intranet
    >>> server are domain members, and the task is running using the domain
    >>> administrator account. I've also tried checking the "Run with highest
    >>> privileges" box. If I go to the command prompt, navigate to the scripts
    >>> director and type "estimate.cmd", the script runs fine, both files are
    >>> copied successfully. If I set this up as a scheduled task it fails with
    >>> result 0x1. I am unable to determine what this error means for the copy
    >>> command, and it just boggles my mind why it would fail in the first
    >>> place, since running the script manually works without a problem.
    >>>
    >>> I've tried using the /Y switch in case whatever environment is running
    >>> the script just doesn't like the fact that the file already exists at
    >>> the destination. I've also tried adding > ppg.log at the end of the
    >>> first line and >> ppg.log at the end of the second to record some sort
    >>> of output, but no files were created.
    >>>
    >>> I welcome any advice, as I'm at my wit's end here. The other scripts
    >>> I've just given up and ran them from the target, copying from the source
    >>> to themselves, but I would like to nail down once and for all just what
    >>> is so different about the Windows 2008 Task Scheduler that is causing
    >>> every script I've ever used to not run without issue. Thanks in
    >>> advance.
    >>>
    >>> Joe

    >>
    >> Standard solution: Give yourself some eyes so that you can see what's
    >> going on. Here is the modified version of your batch file:
    >>
    >> @echo off
    >> echo %date% %time% %UserName% %ComputerName% >> c:\test.txt
    >> Copy /y "C:\DATA\estimate\Resource Tools\HardBids.xls"
    >> "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup" 1>>c:\test.txt
    >> 2>>&1
    >> Copy /y "C:\DATA\estimate\Resource Tools\CurrentEstimatLoad.xls"
    >> "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup" 1>>c:\test.txt
    >> 2>>&1
    >> echo %date% %time% End of task >> c:\test.txt
    >>
    >> Note that the /y switch belongs into the batch file if you want it to be
    >> robust, not into the environment.
    >>
    >> Now examine c:\test.txt and all will become clear.
    >>

    >




  5. #5
    Joe Grover Guest

    Re: Windows 2008 Scheduled Tasks

    I'm sorry, it was &1. I messed it up when posting my reply here. :)

    I did copy/paste it, which is what caused my truncating problem as Windows
    Mail truncated the lines, making both copy commands 3 lines each (one line
    ending with the source filename, the second line ending with the log file
    name, and the third line being the 2>>&1 statement).

    All in all I think I'm all straightened out. I went back to the previous
    scripts I'd had problems with (and you'd tried to help me with), such as
    using robocopy for data replication and whatnot and removed extraneous
    spacing from those commands and they are working fine on the 2008 box as
    well. Rock on!

    Joe

    "Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
    news:OFkwgIUYJHA.1532@TK2MSFTNGP03.phx.gbl...
    > Thanks for the feedback.
    >
    > By the way, I never wrote "2>>$1" - I wrote "2>>&1". The difference is
    > crucial for the debugging effort and it would have highlighted the error
    > caused by the trailing spaces. I should have warned you not to retype my
    > code but to copy/paste it - it's much more efficient anyway!
    >
    >
    > "Joe Grover" <grover.joe@acd.net> wrote in message
    > news:OrE85jTYJHA.5476@TK2MSFTNGP03.phx.gbl...
    >> Well... um... It completed successfully. No error.
    >>
    >> However, thanks to me playing with the script you posted I think I've
    >> found the problem.
    >>
    >> Originally when I put your script in there I didn't edit it so the
    >> "2>>$1" command was on the same line as the Copy command, so the task
    >> failed with a new error (0xFF) and the text file only said "1 file
    >> copied", which was likely the log file. I changed it and ran it again
    >> and it completed successfully.
    >>
    >> I then went back into my original script and I saw that the second Copy
    >> command had a space at the end of the string. I started looking at other
    >> scripts I had problems with and found similar issues in those (these are
    >> not scripts I've created, just ones that have been running without issue
    >> on an older server for time beyond counting that I copied over to this
    >> new 2008 machine). Apparently 2008 is less tolerant of these trailing
    >> spaces (at least when running at ask, as the scripts work fine if you
    >> just execute them manually).
    >>
    >> I deleted this trailing space, rescheduled the task to run and it
    >> completed successfully. Thanks!
    >>
    >> "Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
    >> news:uKWe%239HYJHA.2280@TK2MSFTNGP06.phx.gbl...
    >>>
    >>> "Joe Grover" <grover.joe@acd.net> wrote in message
    >>> news:eG2kdvHYJHA.4852@TK2MSFTNGP04.phx.gbl...
    >>>> Man, I just don't know what it is that's so different in 2008 that's
    >>>> giving me such headaches with scheduled tasks.
    >>>>
    >>>> Since converting from a Windows 2003 server to 2008 for our file server
    >>>> I've had numerous problems with scheduled tasks no longer running.
    >>>> I've set them up as identically as I can tell (given the differences
    >>>> between the two task scheduler interfaces), running the same script
    >>>> files, and they just don't want to run on the 2008--but only as a
    >>>> scheduled task. If I run the .cmd from the command line it works fine.
    >>>>
    >>>> For example:
    >>>>
    >>>> I have a basic script (estimating.cmd) that uses the Windows copy
    >>>> command to copy two Excel documents from a departmental share to our
    >>>> intranet site. The script is as follows:
    >>>>
    >>>> Copy "C:\DATA\estimate\Resource Tools\HardBids.xls"
    >>>> "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup"
    >>>> Copy "C:\DATA\estimate\Resource Tools\CurrentEstimatLoad.xls"
    >>>> "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup"
    >>>>
    >>>> Both the file server (that the script is running on) and the intranet
    >>>> server are domain members, and the task is running using the domain
    >>>> administrator account. I've also tried checking the "Run with highest
    >>>> privileges" box. If I go to the command prompt, navigate to the scripts
    >>>> director and type "estimate.cmd", the script runs fine, both files are
    >>>> copied successfully. If I set this up as a scheduled task it fails with
    >>>> result 0x1. I am unable to determine what this error means for the
    >>>> copy command, and it just boggles my mind why it would fail in the
    >>>> first place, since running the script manually works without a problem.
    >>>>
    >>>> I've tried using the /Y switch in case whatever environment is running
    >>>> the script just doesn't like the fact that the file already exists at
    >>>> the destination. I've also tried adding > ppg.log at the end of the
    >>>> first line and >> ppg.log at the end of the second to record some sort
    >>>> of output, but no files were created.
    >>>>
    >>>> I welcome any advice, as I'm at my wit's end here. The other scripts
    >>>> I've just given up and ran them from the target, copying from the
    >>>> source to themselves, but I would like to nail down once and for all
    >>>> just what is so different about the Windows 2008 Task Scheduler that is
    >>>> causing every script I've ever used to not run without issue. Thanks
    >>>> in advance.
    >>>>
    >>>> Joe
    >>>
    >>> Standard solution: Give yourself some eyes so that you can see what's
    >>> going on. Here is the modified version of your batch file:
    >>>
    >>> @echo off
    >>> echo %date% %time% %UserName% %ComputerName% >> c:\test.txt
    >>> Copy /y "C:\DATA\estimate\Resource Tools\HardBids.xls"
    >>> "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup" 1>>c:\test.txt
    >>> 2>>&1
    >>> Copy /y "C:\DATA\estimate\Resource Tools\CurrentEstimatLoad.xls"
    >>> "\\lan-intranet\c$\Inetpub\wwwroot\ProjectPlanningGroup" 1>>c:\test.txt
    >>> 2>>&1
    >>> echo %date% %time% End of task >> c:\test.txt
    >>>
    >>> Note that the /y switch belongs into the batch file if you want it to be
    >>> robust, not into the environment.
    >>>
    >>> Now examine c:\test.txt and all will become clear.
    >>>

    >>

    >
    >



Similar Threads

  1. Windows Scheduled Tasks don't luanch if tasks not finished
    By Andy Candy in forum Windows Software
    Replies: 3
    Last Post: 21-08-2009, 11:47 AM
  2. Scheduled Tasks in Windows Server 2003 (SP1) could not start
    By Nigel in forum Windows Server Help
    Replies: 8
    Last Post: 05-02-2009, 08:28 PM
  3. Scheduled Tasks: Notify me of missed tasks
    By Hrishia in forum Windows XP Support
    Replies: 1
    Last Post: 02-01-2009, 02:45 PM
  4. Where are kept Scheduled tasks?
    By Jack in forum Vista Help
    Replies: 8
    Last Post: 18-01-2008, 01:28 AM
  5. Windows 2003 scheduled tasks
    By Solitario in forum Windows Security
    Replies: 3
    Last Post: 12-04-2006, 03:47 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,182,090.01216 seconds with 17 queries