I'm trying to write some code to monitor scheduled tasks on a remote server (Windows Server 2003). I have it as a scheduled task on another server.
I found that the NextRunTime in the Task object isn't getting reset properly after the task runs when the task is setup to run only once a day. If an Interval is set, 5 minutes, 1 hour, whatever, then the problem doesn't occur. If I run the same code on
the remote server itself, then the issue doesn't occur. After some time (8 or 9 hours) then the NextRunDate is reported correctly by the Task object. Note than on the remote server, the next run time in the Scheduled Tasks object is always correct.
For example, I have a task on server Remote1 named EndOfDay that is setup to run at 10:30 PM once a day. After the EndOfDay job has successfully run, for the next few hours (8 or 9), the my Task Monitor running on server Remote2 sees the original NextRunTime
and reports that the EndOfDay hasn't run.
Again, this only happens when I'm monitoring from a remote server and when the task is setup to run once a day.
FYI, The server I'm monitoring is running on CET (Central European Time) and the server I'm monitoring from is on Eastern Time.