Guest alicorn2 Posted April 18, 2008 Posted April 18, 2008 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
Guest Pegasus \(MVP\) Posted April 18, 2008 Posted April 18, 2008 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?
Guest alicorn2 Posted April 18, 2008 Posted April 18, 2008 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
Guest Pegasus \(MVP\) Posted April 18, 2008 Posted April 18, 2008 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.aspx?scid=kb;en-us;812400 Please let us know if it fixes your problem?
Guest alicorn2 Posted April 18, 2008 Posted April 18, 2008 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.aspx?scid=kb;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
Guest Pegasus \(MVP\) Posted April 18, 2008 Posted April 18, 2008 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.aspx?scid=kb;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.
Guest alicorn2 Posted April 21, 2008 Posted April 21, 2008 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
Guest Pegasus \(MVP\) Posted April 21, 2008 Posted April 21, 2008 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?
Guest alicorn2 Posted April 21, 2008 Posted April 21, 2008 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.
Recommended Posts