有没有办法让每个计划的任务都被创建,以便任务始终在之前和之后运行

时间:2015-08-21 13:28:43

标签: windows-server-2008

我正在尝试在计划任务运行之前和运行完毕之后将数据保存到数据库,以便我可以监控许多事情。

我可以在每项任务之前和之后手动添加额外的操作,但我不能保证其他用户也会这样做。

对于包括将来创建的新任务在内的所有任务,是否有某种方法可以始终在之前和之后运行这些其他操作?

我正在使用WIN 2008 R2。

1 个答案:

答案 0 :(得分:1)

格雷厄姆,

是的,可以通过添加1个以上的动作集来实现 -

<Actions Context="Author">
  <Exec>
    <Command>C:\Windows\System32\wscript.exe</Command>
    <Arguments>u:\Scripts\Pre_test.vbs</Arguments>
  </Exec>
  <Exec>
    <Command>C:\Windows\System32\wscript.exe</Command>
    <Arguments>u:\Scripts\test.vbs</Arguments>
  </Exec>
  <Exec>
    <Command>C:\Windows\System32\wscript.exe</Command>
    <Arguments>u:\Scripts\Post_Test.vbs</Arguments>
  </Exec>
</Actions>

让我知道它是否有效。