简体   繁体   English

计划任务事件触发器,以编程方式访问事件触发器信息

[英]Scheduled Task Event Trigger, Programmatic Access to Event Trigger Information

Is there an exposed object related to the object that triggered the event? 是否存在与触发事件的对象相关的暴露对象?

I'm trying to create a trigger that fires on an event and then kick off a PowerShell script that runs, deterministically logs information from that specific event, where required. 我正在尝试创建一个在事件上触发的触发器,然后启动运行的PowerShell脚本,并在需要时确定性地记录该特定事件的信息。

What I'm looking for is analogous to the WMI Asynchronous Subscription information where an event log item returns an $Event.NewEvent() object that contains all of the relevant data about the event that fired the subscription. 我要查找的内容类似于WMI异步订阅信息,其中事件日志项返回$ Event.NewEvent()对象,该对象包含有关触发订阅事件的所有相关数据。

In the case of Scheduled Task -> Event triggers, do I need to re-query the event log for my data or is there a way to access the data in the event that triggered the scheduled task? 对于计划任务->事件触发器,是否需要重新查询事件日志中的数据,或者是否有方法在触发计划任务的事件中访问数据?

Try 尝试

gwmi -Namespace Root\\cimv2 -class Win32_ScheduledJob gwmi-命名空间Root \\ cimv2 -class Win32_ScheduledJob

for getting the list of all scheduled tasks. 用于获取所有计划任务的列表。

Reference 参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM