Discussion Locked

Send alert on failed Scheduled Tasks

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How can I send a network message when a scheudled tasks failes with codes 0x1 or 0xa (anything other than return code 0x0) from an NT server to a networked PC on the same domain?

5 replies

by timthetoolman

Hi,

You could do whatever the scheduled task does in a batch file with error checking and a net send in the case of a failure. For example if you wanted to run notepad every day, then the batch file would look

notepad
if not errorlevel 0 gotofail
exit

:fail
net send YourComputerName "Failed to start notepad"

...and you'd schedule the running of the batch file rather than "notepad.exe" itself.

Cheers,
Tim.

by cpshambro

The solution has to also work if the scheduled task is not able to access the batch file for any reason. For example, if the task fails because permissions were not granted to the user account that was assigned to the task to access the batch file,a broadcast message should be sent to YourComputerName.

by timthetoolman

Hi,

I dont think thats going to be an issue. You set it up. You test it. And it works...

If it stopped working for whatever reason, then you'll know why - because you've just changed something in that area. Unless what you want to do with thisis a bit bizarre, then once set up, doesn't change, so wont break.

Actually I'd be more concerned that the net send doesn't work as network connectivity problems will be far more common than changes that will affect the running of the scheduled task!

But there are only so many things you can do... unless you wanted to force the server to dial a modem that's purpose is purely to dial your mobile phone to tell you the net send failed...

But where does the checking stop? You need to decide whether you're trying to protect yourself from double failures as well as single ones.

Periodic checking that the scheduled tasks are running correctly would be worthwhile and I'd suggest logging the output from the commands.

Cheers,
Tim.

This discussion is closed to new replies.