Home All Groups Group Topic Archive Search About

Task Scheduler weird issue

Author
2 Jan 2007 6:34 PM
Yann
Hi,

My question is about the Task Scheduler.

Here's what I'm trying to do:
- each day, making a comparison between 2 text files and save the text
differences in a new file and send it by email.
- a batch file calling a vbscript with 3 parameters

using a Windows 2000 Server SP4 (not in a domain),
a user especially created to run scheduled tasks with modify permissions on
the folders that contain the files to be modified and the scripts, with Read
& Execute rights on the scheduled task. The local policy was modified so that
this user cannot log on locally, cannot log on through the network, cannot
log on as a service, but can only log on as a batch job, and its password
will never expire and cannot be modified by itself,
the scheduled task is to be run as this user every morning (daily at 7:00AM)

- When I'm running the batch file with my own account (member of
administrators), it's working great.
- When I'm right clicking the scheduled task and select run, it's working
great with this created user
- When I schedule to run the task 10 minutes after I left the Remote Desktop
session, it still works
- BUT when I modify only the date and time of running, and I want it to run
every morning at 6:00AM, it won't work anymore.

When I check the scheduled log: it's as usual = exited with no error,
when I check the event viewer = no error, my special account logged on at
6:00AM and exited successfully,
BUT I know that nothing happened since there is no difference text file
created at this time.

So, I tried to modify the time = no change
to run every 10 minutes for 1 hour this script during the day, it worked fine

Any suggestion or ideas?

Thanks a lot
Yann P.

Author
2 Jan 2007 9:25 PM
Pegasus (MVP)
Show quote Hide quote
"Yann" <Y***@discussions.microsoft.com> wrote in message
news:621C582D-95DB-4D9E-8052-4E2E32A8E9C5@microsoft.com...
> Hi,
>
> My question is about the Task Scheduler.
>
> Here's what I'm trying to do:
> - each day, making a comparison between 2 text files and save the text
> differences in a new file and send it by email.
> - a batch file calling a vbscript with 3 parameters
>
> using a Windows 2000 Server SP4 (not in a domain),
> a user especially created to run scheduled tasks with modify permissions
on
> the folders that contain the files to be modified and the scripts, with
Read
> & Execute rights on the scheduled task. The local policy was modified so
that
> this user cannot log on locally, cannot log on through the network, cannot
> log on as a service, but can only log on as a batch job, and its password
> will never expire and cannot be modified by itself,
> the scheduled task is to be run as this user every morning (daily at
7:00AM)
>
> - When I'm running the batch file with my own account (member of
> administrators), it's working great.
> - When I'm right clicking the scheduled task and select run, it's working
> great with this created user
> - When I schedule to run the task 10 minutes after I left the Remote
Desktop
> session, it still works
> - BUT when I modify only the date and time of running, and I want it to
run
> every morning at 6:00AM, it won't work anymore.
>
> When I check the scheduled log: it's as usual = exited with no error,
> when I check the event viewer = no error, my special account logged on at
> 6:00AM and exited successfully,
> BUT I know that nothing happened since there is no difference text file
> created at this time.
>
> So, I tried to modify the time = no change
> to run every 10 minutes for 1 hour this script during the day, it worked
fine
>
> Any suggestion or ideas?
>
> Thanks a lot
> Yann P.

There are several perfectly good reasons why your
batch file might fail, none of them weird. Your first
step should be to include some code that ***really***
tells you if the batch file runs, e.g. like so:

@echo off
echo %date% %time:~0,5% >> c:\test.log
{put your code here}

You will probably find that the batch file runs each
and every time it is scheduled but that it bombs out
on the subsequent code. Post that code here if you
need further advice.
Are all your drivers up to date? click for free checkup

Author
3 Jan 2007 6:14 PM
Yann
OK my bad, I found my mistake. It was in the vbscript, I test the
lastAccessedDate of the text file to be sure it was "accessed"... I was
convinced it was accessed since the backup system keeps this file open. Well
it seems that it can be kept open without modifying the last accessed date.

Nothing against the task scheduler anymore.
Please Great Task Scheduler forgive me that I doubt of you.

Thanks
Yann P.



Show quoteHide quote
"Pegasus (MVP)" wrote:

> There are several perfectly good reasons why your
> batch file might fail, none of them weird. Your first
> step should be to include some code that ***really***
> tells you if the batch file runs, e.g. like so:
>
> @echo off
> echo %date% %time:~0,5% >> c:\test.log
> {put your code here}
>
> You will probably find that the batch file runs each
> and every time it is scheduled but that it bombs out
> on the subsequent code. Post that code here if you
> need further advice.
>
>
>
Author
3 Jan 2007 8:48 PM
Pegasus (MVP)
Thanks for the feedback. Your problem pops up with
great regularity and it easily solved by including some
very, very simple diagnostics that cannot possibly go wrong.

echo %date% %time% >> c:\test.txt

Show quoteHide quote
"Yann" <Y***@discussions.microsoft.com> wrote in message
news:6C56A7DF-0987-4660-9EA9-E7E299D23905@microsoft.com...
> OK my bad, I found my mistake. It was in the vbscript, I test the
> lastAccessedDate of the text file to be sure it was "accessed"... I was
> convinced it was accessed since the backup system keeps this file open.
Well
> it seems that it can be kept open without modifying the last accessed
date.
>
> Nothing against the task scheduler anymore.
> Please Great Task Scheduler forgive me that I doubt of you.
>
> Thanks
> Yann P.
>
>
>
> "Pegasus (MVP)" wrote:
>
> > There are several perfectly good reasons why your
> > batch file might fail, none of them weird. Your first
> > step should be to include some code that ***really***
> > tells you if the batch file runs, e.g. like so:
> >
> > @echo off
> > echo %date% %time:~0,5% >> c:\test.log
> > {put your code here}
> >
> > You will probably find that the batch file runs each
> > and every time it is scheduled but that it bombs out
> > on the subsequent code. Post that code here if you
> > need further advice.
> >
> >
> >

Bookmark and Share

Post Thread options