1、计划从Windows系统日志中读取 “关机”“休眠”“异常关机”日志。
2、Windows系统中的“EventLog”只有“异常关机”。
3、关机”“休眠”只能从“来源:Kernel-Power”过滤。
通过Windows日志-->系统 可以按照上面的条件过滤到 需求的三种日志,但代码实现的时候会报如下错误:(代码片附上)
无法找到源“Microsoft-Windows-Kernel-Power”中事件 ID“41”的说明。 本地计算机可能没有显示该消息所需的注册表信息或消息 DLL 文件,或者您可能无权访问它们。 下列信息是该事件的一部分:'0', '0x0', '0x0', '0x0', '0x0', '1', '132100000642360336', '0', '2', 'false', '4', '0', 'false', '0'
EventLogEntryCollection collection = eventLog1.Entries;
foreach(EventLogEntry entry in collection)
{
if (entry.Source.ToString().Equals(eventSource)&& entry.EntryType.ToString().Equals("0"))
{
info += entry.Message+"\r\n";
}
}
实在是搜不到解决方式了,特来求教
新手求板砖