小编Dan*_*son的帖子

用于启动/关闭锁定/解锁的 Windows 事件代码

我正在尝试建立一个事件 ID 列表,可用于确定机器何时关闭、启动、锁定和解锁。到目前为止,我发现了 6 个似乎是最佳候选者的事件 ID,但我想知道是否有更好的方法来确定它。

以下是我发现来自“电源故障排除程序”、“User32”、“EventLog”和“Microsoft Windows 安全审核”来源的有用的事件 ID 列表(1、1074、6005、6006、4800、4801) . 这些来自 Windows 10 (v1511),目前 Windows 10 是我唯一的目标要求,因为这是所有客户端计算机运行的内容。

事件 ID 列表

这是我建立的一个示例过滤器查询

<QueryList>
  <Query Id="0" Path="System">
    <!-- Shutdown -->
    <Select Path="System">*[System[Provider[@Name='User32'] and (EventID=1074) and TimeCreated[@SystemTime &gt;= '2017-11-28T00:00:00.0000000']]]</Select>

    <!-- Event Service Stop/Start -->
    <Select Path="System">*[System[Provider[@Name='eventlog'] and (EventID=6005 or EventID=6006) and TimeCreated[@SystemTime &gt;= '2017-11-28T00:00:00.0000000']]]</Select>

    <!-- Startup -->
    <Select Path="System">*[System[Provider[@Name='Microsoft-Windows-Power-Troubleshooter'] and (EventID=1) and TimeCreated[@SystemTime &gt;= '2017-11-28T00:00:00.0000000']]]</Select>

    <!-- Machine Lock/Unlock -->
    <Select Path="Security">*[System[Provider[@Name='Microsoft-Windows-Security-Auditing'] and (EventID=4800 or EventID=4801) and TimeCreated[@SystemTime &gt;= '2017-11-28T00:00:00.0000000']]]</Select>
  </Query>
</QueryList>
Run Code Online (Sandbox Code Playgroud)

我故意将查询中的源分开,它们可以连接在一起,但这牺牲了 IMO 的可读性。 …

windows windows-event-log eventviewer

4
推荐指数
1
解决办法
3万
查看次数

标签 统计

eventviewer ×1

windows ×1

windows-event-log ×1