任务停止时运行脚本 [英] Run Script if Task stops

查看:92
本文介绍了任务停止时运行脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


好几个星期我想知道如果计划的Windows任务意外停止或没有启动,是否可以运行脚本。



我的想法是创建了一个PowerShell脚本,如果特殊服务意外关闭,它会通过SMTP发送邮件通知。

这对我来说很好。



但是现在我有这种情况我想发送通知邮件,如果任务不再运行,因为我的客户有一个特殊的计划任务。 / p>

如果任务状态切换为"就绪",是否有任何选项可以运行脚本或"停止"?


请告知:)

解决方案

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


参见
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


这篇关于任务停止时运行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆