且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

任务停止时运行脚本

更新时间:2023-12-04 10:00:58

不,但你可以任务事件日志条目。


参见
http://blogs.technet.com/b/jhoward/archive/2010/06/16/getting-event-log -contents逐电子邮件上的事件日志-trigger.aspx


Hi there folks,

for some weeks I wonder if it is possible to run a script if a scheduled Windows task stops unexpectedly or did not start.

The idea is that I created a PowerShell script that sends a Mail notification via SMTP if a special service shutdown unexpectedly.
This works fine for me.

But now I have the situation I'd like to send a notification mail if a task does not run any longer because I have a special scheduled task for my customers.

Is there any option to run a script if task state switches to "ready" or "stop"?

Please advise :)

No but you can task the event log entries.

See http://blogs.technet.com/b/jhoward/archive/2010/06/16/getting-event-log-contents-by-email-on-an-event-log-trigger.aspx