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

Sponsored Links



Can't run scheduled task

Windows Server Help


Reply
 
Thread Tools Search this Thread
  #1  
Old 18-04-2008
alicorn2
 
Posts: n/a
Can't run scheduled task

I'm having "fun" today :)

Windows Server 2003 R2, Standard Edition, Service Pack 1

I have a scheduled task that I want to run a batch file hourly, as a
service, with no one logged in. I've simplified and simplified, so now I'm
down to bare bones using a different batch file that does next to nothing to
try to troubleshoot it.

The "test" batch file has this in it:
@echo off
echo %date% %time% Start of task, running as %UserName% >> c:\temp\test.log
REM this is where I was calling my real batch file, but I've even taken that
out now
echo %date% %time% End of task >> c:\temp\test.log
echo ------------------------- >> c:\temp\test.log

Scenarios:
Log in (via remote desktop) as myself. Run batch file by double-clicking
it. Success.
Log in (via remote desktop) as the service account I want to use. Run batch
file by double-clicking it. Success.
Log in (via remote desktop) as myself in one window and as the service
account in another remote desktop window. Run batch file by going into
scheduled tasks (under my ID) and doing right-click, run. (The task is set
to run as the service account.) Success.
Log off the second window, so I only have one connection, logged in as
myself OR let the scheduled task run on schedule with no one logged on. Task
fails with exit code 80.

The service account is a member of the local group Administrators. It has
been granted both "Log on as a batch job" and "Log on as a service" in
gpedit.msc / computer / windows / local policies / user rights.

Help! I'm going to go bald if I rip out much more of my hair! :)

Thanks,
Beverley

Reply With Quote
  #2  
Old 18-04-2008
Pegasus \(MVP\)
 
Posts: n/a
Re: Can't run scheduled task


"alicorn2" <alicorn2@discussions.microsoft.com> wrote in message
news:804CC95D-8B1B-4A91-AD6F-51CC31ADA72A@microsoft.com...
> I'm having "fun" today :)
>
> Windows Server 2003 R2, Standard Edition, Service Pack 1
>
> I have a scheduled task that I want to run a batch file hourly, as a
> service, with no one logged in. I've simplified and simplified, so now
> I'm
> down to bare bones using a different batch file that does next to nothing
> to
> try to troubleshoot it.
>
> The "test" batch file has this in it:
> @echo off
> echo %date% %time% Start of task, running as %UserName% >>
> c:\temp\test.log
> REM this is where I was calling my real batch file, but I've even taken
> that
> out now
> echo %date% %time% End of task >> c:\temp\test.log
> echo ------------------------- >> c:\temp\test.log
>
> Scenarios:
> Log in (via remote desktop) as myself. Run batch file by double-clicking
> it. Success.
> Log in (via remote desktop) as the service account I want to use. Run
> batch
> file by double-clicking it. Success.
> Log in (via remote desktop) as myself in one window and as the service
> account in another remote desktop window. Run batch file by going into
> scheduled tasks (under my ID) and doing right-click, run. (The task is
> set
> to run as the service account.) Success.
> Log off the second window, so I only have one connection, logged in as
> myself OR let the scheduled task run on schedule with no one logged on.
> Task
> fails with exit code 80.
>
> The service account is a member of the local group Administrators. It has
> been granted both "Log on as a batch job" and "Log on as a service" in
> gpedit.msc / computer / windows / local policies / user rights.
>
> Help! I'm going to go bald if I rip out much more of my hair! :)
>
> Thanks,
> Beverley


Nice piece of testing here! There are a few extra steps I would
take at this stage:
- When the task fails, does it still update c:\test.log?
- What happens when you schedule the task to run under the Administrator
account?
- What does the Task Scheduler log file report?


Reply With Quote
  #3  
Old 19-04-2008
alicorn2
 
Posts: n/a
Re: Can't run scheduled task

"Pegasus (MVP)" wrote:
> Nice piece of testing here! There are a few extra steps I would
> take at this stage:
> - When the task fails, does it still update c:\test.log?


No - it doesn't change the log file at all.

> - What happens when you schedule the task to run under the Administrator
> account?


We don't have a local "Administrator" user on the machine (deleted the
default one per our policy), but the service account I'm using is a member of
the local "Administrators" group.

I tried changing to run under my own personal server administrator ID, set
the schedule for 2 minutes in the future, and logged off the terminal window.
It behaved the same as when I set it to run as the service account (exit
code 80, no update to the log file)

Then I tried changing it to run under my regular (non-server-administrator,
but privileged for everything else I do) ID, updated the schedule for another
2 minutes, and logged off again. Same result - no update, exit code 80.

> - What does the Task Scheduler log file report?


"test photo galleries job.job" (test.bat)
Started 4/18/2008 11:29:18 AM
"test photo galleries job.job" (test.bat)
Finished 4/18/2008 11:29:18 AM
Result: The task completed with an exit code of (80).

Always the same as this, only the time changes. And when it tries to run
the real job that does actual work, it still completes within the same second
as it started, rather than taking 5 minutes like it should if successful.

You see why this is so much fun, huh? :)
Beverley
Reply With Quote
  #4  
Old 19-04-2008
Pegasus \(MVP\)
 
Posts: n/a
Re: Can't run scheduled task


"alicorn2" <alicorn2@discussions.microsoft.com> wrote in message
news:7768DE0A-4CDB-47E7-BEE2-25EB480462D5@microsoft.com...
> "Pegasus (MVP)" wrote:
>> Nice piece of testing here! There are a few extra steps I would
>> take at this stage:
>> - When the task fails, does it still update c:\test.log?

>
> No - it doesn't change the log file at all.
>
>> - What happens when you schedule the task to run under the Administrator
>> account?

>
> We don't have a local "Administrator" user on the machine (deleted the
> default one per our policy), but the service account I'm using is a member
> of
> the local "Administrators" group.
>
> I tried changing to run under my own personal server administrator ID, set
> the schedule for 2 minutes in the future, and logged off the terminal
> window.
> It behaved the same as when I set it to run as the service account (exit
> code 80, no update to the log file)
>
> Then I tried changing it to run under my regular
> (non-server-administrator,
> but privileged for everything else I do) ID, updated the schedule for
> another
> 2 minutes, and logged off again. Same result - no update, exit code 80.
>
>> - What does the Task Scheduler log file report?

>
> "test photo galleries job.job" (test.bat)
> Started 4/18/2008 11:29:18 AM
> "test photo galleries job.job" (test.bat)
> Finished 4/18/2008 11:29:18 AM
> Result: The task completed with an exit code of (80).
>
> Always the same as this, only the time changes. And when it tries to run
> the real job that does actual work, it still completes within the same
> second
> as it started, rather than taking 5 minutes like it should if successful.
>
> You see why this is so much fun, huh? :)
> Beverley


A small amount of googling turned up this link:

Scheduled tasks may not run and generate an exit code of 80
http://support.microsoft.com/default...b;en-us;812400
Please let us know if it fixes your problem?


Reply With Quote
  #5  
Old 19-04-2008
alicorn2
 
Posts: n/a
Re: Can't run scheduled task

"Pegasus (MVP)" wrote:
> A small amount of googling turned up this link:
>
> Scheduled tasks may not run and generate an exit code of 80
> http://support.microsoft.com/default...b;en-us;812400
> Please let us know if it fixes your problem?


I did see that article earlier before I posted my original note here, but it
indicates it is for Windows XP Pro.

There was another hotfix that I found that was for Windows Server 2003, but
it had a very specific set of conditions that didn't match this situation...
relating to using the AT command (rather than the Scheduled Tasks window) and
logging in as a particular user and I forget the third condition.

Beverley
Reply With Quote
  #6  
Old 19-04-2008
Pegasus \(MVP\)
 
Posts: n/a
Re: Can't run scheduled task


"alicorn2" <alicorn2@discussions.microsoft.com> wrote in message
news:01E51C89-BE87-4DBF-99A6-3C63CC406F41@microsoft.com...
> "Pegasus (MVP)" wrote:
>> A small amount of googling turned up this link:
>>
>> Scheduled tasks may not run and generate an exit code of 80
>> http://support.microsoft.com/default...b;en-us;812400
>> Please let us know if it fixes your problem?

>
> I did see that article earlier before I posted my original note here, but
> it
> indicates it is for Windows XP Pro.
>
> There was another hotfix that I found that was for Windows Server 2003,
> but
> it had a very specific set of conditions that didn't match this
> situation...
> relating to using the AT command (rather than the Scheduled Tasks window)
> and
> logging in as a particular user and I forget the third condition.
>
> Beverley


I would still disable the Human Interface Device Access service, then reboot
the machine.

I also wonder what happens when you schedule the task using at.exe instead
of the GUI:

at 14:00 /every:m,t,w,th,f,s,su c:\tools\test.bat

Doing this will run the task under the System account, which puts it
outside the usual policy restrictions.


Reply With Quote
  #7  
Old 22-04-2008
alicorn2
 
Posts: n/a
Re: Can't run scheduled task

Looks like we've got it straightened out now. My hardware-inclined coworker
(I'm more software-inclined) noticed that I had 200+ command sessions
connected to the machine, so he rebooted it, and now it's working.

I forgot the first rule of computers. Rebooting fixes everything. :)

Thanks for all your help Pegasus!

Beverley
Reply With Quote
  #8  
Old 22-04-2008
Pegasus \(MVP\)
 
Posts: n/a
Re: Can't run scheduled task


"alicorn2" <alicorn2@discussions.microsoft.com> wrote in message
news:8E6DBB22-A610-4DD9-841C-53A8631B440B@microsoft.com...
> Looks like we've got it straightened out now. My hardware-inclined
> coworker
> (I'm more software-inclined) noticed that I had 200+ command sessions
> connected to the machine, so he rebooted it, and now it's working.
>
> I forgot the first rule of computers. Rebooting fixes everything. :)
>
> Thanks for all your help Pegasus!
>
> Beverley


Wow, 200+ Command Prompts. You must be a busy worker! Do
you sometimes look at the Task Bar?


Reply With Quote
  #9  
Old 22-04-2008
alicorn2
 
Posts: n/a
Re: Can't run scheduled task



"Pegasus (MVP)" wrote:

>
> "alicorn2" <alicorn2@discussions.microsoft.com> wrote in message
> news:8E6DBB22-A610-4DD9-841C-53A8631B440B@microsoft.com...
> > Looks like we've got it straightened out now. My hardware-inclined
> > coworker
> > (I'm more software-inclined) noticed that I had 200+ command sessions
> > connected to the machine, so he rebooted it, and now it's working.
> >
> > I forgot the first rule of computers. Rebooting fixes everything. :)
> >
> > Thanks for all your help Pegasus!
> >
> > Beverley

>
> Wow, 200+ Command Prompts. You must be a busy worker! Do
> you sometimes look at the Task Bar?
>
>
>


LOL

I didn't really have that many open, not interactively. I wasn't even
logged in at the time. The batch file must have been starting, hanging, and
staying resident while it was trying to run under my ID. Or something. It's
all cleared up now anyway.
Reply With Quote
Reply

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



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Can't run scheduled task"
Thread Thread Starter Forum Replies Last Post
Windows Scheduled Task: Unable to start task. 0x80070005: Access is denied. BCU_AJones Windows Software 3 17-01-2014 10:37 AM
Scheduled Task does not run coreymac1222 Windows XP Support 3 06-03-2009 02:06 AM
Scheduled Task - Can Not Start Matt Colegrove Windows Server Help 3 08-06-2007 10:29 AM
How to run a scheduled task via a batch job akkha1234@gmail.com Windows Server Help 3 18-05-2007 06:35 PM
Scheduled Task error code:The task completed with an exit code of Teo Chee Yang Windows Server Help 7 26-02-2007 06:01 PM


All times are GMT +5.5. The time now is 10:54 PM.