Go Back   TechArena Community > Technical Support > Computer Help > Windows Server > Windows Server Help
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: ,

Sponsored Links



Windows 2008 Scheduled Tasks

Windows Server Help


Reply
 
Thread Tools Search this Thread
  #1  
Old 18-12-2008
Joe Grover
 
Posts: n/a
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

Reply With Quote
  #2  
Old 18-12-2008
Pegasus \(MVP\)
 
Posts: n/a
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.


Reply With Quote
  #3  
Old 18-12-2008
Joe Grover
 
Posts: n/a
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.
>


Reply With Quote
  #4  
Old 19-12-2008
Pegasus \(MVP\)
 
Posts: n/a
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.
>>

>



Reply With Quote
  #5  
Old 19-12-2008
Joe Grover
 
Posts: n/a
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.
>>>

>>

>
>


Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows Server > Windows Server Help


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Windows 2008 Scheduled Tasks"
Thread Thread Starter Forum Replies Last Post
Windows Scheduled Tasks don't luanch if tasks not finished Andy Candy Windows Software 3 21-08-2009 12:47 PM
Scheduled Tasks in Windows Server 2003 (SP1) could not start Nigel Windows Server Help 8 05-02-2009 08:28 PM
Scheduled Tasks: Notify me of missed tasks Swifty Windows XP Support 2 02-01-2009 02:45 PM
Where are kept Scheduled tasks? Jack Vista Help 8 18-01-2008 01:28 AM
Windows 2003 scheduled tasks Mike Hyatt Windows Security 3 12-04-2006 04:47 AM


All times are GMT +5.5. The time now is 05:55 AM.