【问题标题】:Wevtutil\Event Viewer: Getting list of events with different event ids using XPath FilterWevtutil\Event Viewer:使用 XPath 过滤器获取具有不同事件 ID 的事件列表
【发布时间】:2019-08-16 11:03:05
【问题描述】:

我需要使用“wevtutil”工具获取 ID 为 6005 或 6006 的事件列表。此命令运行良好:

wevtutil qe system /rd:true /q:*[System[EventID=6005]]

但我需要获取 ID 为 6005 和 6006 的两个事件。我试过了

wevtutil qe system /rd:true /q:*[System[EventID=6005 or EventID=6006]]

但它会返回

指定的参数过多。参数不正确。

我应该如何解决它?

注意:每个事件都有以下 XML 结构

<Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'><System><Provider Name='EventLog'/><EventID Qualifiers='32768'>6005</EventID><Level>4</Level><Task>0</Task><Keywords>0x80000000000000</Keywords><TimeCreated SystemTime='2018-01-24T18:24:41.592259500Z'/><EventRecordID>350</EventRecordID><Channel>System</Channel><Computer>LAPTOP-IN03NS68</Computer><Security/></System><EventData><Binary>E20701000300180012001800290050020000000000000000</Binary></EventData></Event>

【问题讨论】:

  • wevtutil.exe 使用 C 运行时的 wmain 入口点,它根据 Parsing C++ Command-Line Arguments 中记录的规则对命令行进行标记。因此,您需要双引号来防止查询被拆分为单独的参数,例如"/q:*[System[EventID=6005 or EventID=6006]]" 甚至看起来很奇怪的/q:*[System[EventID=6005" or "EventID=6006]]

标签: windows xpath wevtutil


【解决方案1】:

"/q:*[系统[(EventID=6005) or (EventID=6006)]]"

【讨论】:

  • 请简要说明您的答案,以便将来也帮助其他用户
【解决方案2】:

eryksun 已经在命令中回答了。必须使用双引号

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-02
    • 1970-01-01
    • 2020-12-11
    • 2015-12-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多