计划任务使用XML无效过滤

时间:2014-03-03 20:45:51

标签: scheduled-tasks xml

我尝试在Window的任务调度程序上使用XML进行触发,但该工具告诉我过滤器无效,我无法找到错误。

我当前的XML是

<QueryList>
  <Query Id="0" Path="Security">
    <Select Path="Security">
      *[System[Provider[@Name='Microsoft-Windows-Security-Auditing'] and (Level=4 or Level=0) and Task = 12801 and (EventID=4656) ]] and
      *[EventData[Data[@Name='SubjectUserSid' and (Data='S-1-5-18')]] and
       [Data[@Name='ObjectType' and (Data=Key) ]]]

   </Select>
  </Query>
</QueryList>

当我删除

and
           [Data[@Name='ObjectType' and (Data=Key) ]]

接受XML而不会出错。因为我不明白我的最后一行有什么问题,所以我被困住了。

1 个答案:

答案 0 :(得分:1)

在SubjectUserSid和ObjectType属性周围有一些缺少的方括号,&#34; * [EventData&#34;从最后一个查询行中丢失,并且数据值&#34;键&#34;周围缺少引号。这适用于我的EventViewer:

<QueryList>
  <Query Id="0" Path="Security">
    <Select Path="Security">
      *[System[Provider[@Name='Microsoft-Windows-Security-Auditing'] and (Level=4 or Level=0) and Task = 12801 and (EventID=4656) ]] and
      *[EventData[Data[@Name='SubjectUserSid'] and (Data='S-1-5-18') ]] and
      *[EventData[Data[@Name='ObjectType'] and (Data='Key') ]]
   </Select>
  </Query>
</QueryList>