windows开关机事件

开关机事件.xml

<ViewerConfig>
    <QueryConfig>
        <QueryParams>
            <Simple>
                <BySource>True</BySource>
                <Channel>System</Channel>
                <Source>eventlog</Source>
                <RelativeTimeInfo>0</RelativeTimeInfo>
                <EventId>6005,6006</EventId>
            </Simple>
        </QueryParams>
        <QueryNode>
            <Name>开关机事件</Name>
            <QueryList>
                <Query Id="0" Path="System">
                    <Select Path="System">*[System[Provider[@Name='eventlog'] and (EventID=6005 or EventID=6006)]]</Select>
                </Query>
            </QueryList>
        </QueryNode>
    </QueryConfig>
</ViewerConfig>

  

将【开关机事件.xml】的内容保存为本地xml文件

我的电脑 - 右键管理 - 系统工具 - 事件查看器 - 导入自定义视图

选择前面保存的xml文件导入即可

原文地址:https://www.cnblogs.com/nihaorz/p/7597162.html