Get-EventLog - 某些事件日志源缺少有效消息

2024-01-11

我正在使用 get-eventlog 提取和过滤系统事件日志数据。我发现 get-event log 无法正确返回与某些条目关联的消息。这些条目通常显示在事件日志查看器中。例如。

get-eventlog -logname system | ? { $_.source -eq "Microsoft-Windows-Kernel-General" }

返回 8 个条目,所有条目都有以下形式的消息:

The description for Event ID '12' in Source 'Microsoft-Windows-Kernel-General' cannot be found.  
The local computer may not have the necessary registry information or message DLL files to display the message, or you may not have permission to access them.  
The following information is part of the event:'6', '1', '7601', '18798', '1', '0', '2015-06-13T08:33:32.359599800Z'

如果我过滤系统事件日志以查找相同的源,我可以清楚地看到完整的消息。例如

The operating system started at system time ‎2015‎-‎06‎-‎13T08:33:32.359599800Z.

我运行以下命令来查看是否有任何其他提供程序无法返回有效的事件消息:

get-eventlog -LogName system | ? { $_.Message -like "The description for Event ID*" }  | Group-Object -Property Source | Select-Object -Property Name

Name
----
Microsoft-Windows-Kernel-General
DCOM
WinRM
Microsoft-Windows-Iphlpsvc

我在事件日志查看器中检查了 DCOM、WinRM 和 Iphlpsvc 源的相应条目,并确认可以看到正确的消息。

我已在管理员级 PowerShell 控制台中运行测试脚本。

有任何想法吗?

编辑:进一步的研究表明 PsLogList 似乎也遇到同样的问题,而 WEVTUTIL 则没有。

编辑:根据Windos的建议,我尝试了get-winevent。我之前尝试过这个,发现它根本不会返回任何 Message 数据。我又试了一次,发现了同样的结果。然后我尝试了

Get-WinEvent -ProviderName "Microsoft-Windows-Kernel-General"

这产生了以下错误

Could not retrieve information about the Microsoft-Windows-Kernel-General provider. Error: The locale specific resource for the desired message is not present.

一点谷歌搜索让我发现'https://p0w3rsh3ll.wordpress.com/2013/12/13/why-does-my-get-winevent-command-fail/ https://p0w3rsh3ll.wordpress.com/2013/12/13/why-does-my-get-winevent-command-fail/'谁也经历过同样的错误消息。他认为这是由于地区环境造成的。我在澳大利亚,因此控制面板中的“格式”设置为“英语(澳大利亚)”。我将其更改为“英语(美国)”,推出了新的 PS 控制台,并通过get-culture我现在在美国并重新运行了get-winevent命令。

Get-WinEvent -ProviderName "Microsoft-Windows-Kernel-General" | select-object -property Message

你瞧……

Message
-------
The system time has changed to ?2015?-?07?-?12T01:06:52.405000000Z from ?2015?-?07?-?12T01:05:51.764208900Z.
The system time has changed to ?2015?-?07?-?12T01:05:09.671000000Z from ?2015?-?07?-?12T01:04:09.226010500Z.
The system time has changed to ?2015?-?07?-?12T01:03:49.119000000Z from ?2015?-?07?-?12T01:02:48.060593100Z.
The system time has changed to ?2015?-?07?-?12T01:02:32.128000000Z from ?2015?-?07?-?12T01:01:29.610105600Z.
The system time has changed to ?2015?-?06?-?13T08:41:12.267000000Z from ?2015?-?06?-?13T08:41:12.404273100Z.
The operating system started at system time ?2015?-?06?-?13T08:33:32.359599800Z.
The operating system is shutting down at system time ?2015?-?06?-?13T08:33:05.091743100Z.
The system time has changed to ?2015?-?06?-?13T08:32:58.947000000Z from ?2015?-?06?-?13T08:32:58.947959900Z.

可悲的是 - 没有改变get-eventlog

get-eventlog -logname system | ? { $_.Source -eq "microsoft-windows-kernel-general" } | select-object -property Message

Message
-------
The description for Event ID '1' in Source 'Microsoft-Windows-Kernel-General' cannot be found.  The local computer m...
The description for Event ID '1' in Source 'Microsoft-Windows-Kernel-General' cannot be found.  The local computer m...
The description for Event ID '1' in Source 'Microsoft-Windows-Kernel-General' cannot be found.  The local computer m...
The description for Event ID '1' in Source 'Microsoft-Windows-Kernel-General' cannot be found.  The local computer m...
The description for Event ID '1' in Source 'Microsoft-Windows-Kernel-General' cannot be found.  The local computer m...
The description for Event ID '12' in Source 'Microsoft-Windows-Kernel-General' cannot be found.  The local computer ...
The description for Event ID '13' in Source 'Microsoft-Windows-Kernel-General' cannot be found.  The local computer ...
The description for Event ID '1' in Source 'Microsoft-Windows-Kernel-General' cannot be found.  The local computer m...

不确定如何或为什么,但看起来如果你选择Get-WinEvent而不是Get-EventLog你会得到你想要的信息。

应该注意的是,当更改命令时,“Source”参数被称为“ProviderName”,因此您的命令将变为:

Get-WinEvent -LogName System | Where { $_.ProviderName -eq 'Microsoft-Windows-Kernel-General' }
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Get-EventLog - 某些事件日志源缺少有效消息 的相关文章

随机推荐

  • 是否可以检查广播是否以粘性模式发送?可以中止/删除它吗?

    是否可以检查广播是否以粘性模式发送 我们可以完全中止 删除粘性广播吗 如果是的话 那么普通广播和有序广播都可以这样做吗 In onReceive 您可以使用以下调用 isInitialStickyBroadcast 这将告诉您当前正在处理的
  • django:从外键获取对象

    假设以下模型类 class Bookmark models Model owner models ForeignKey UserProfile related name bookmarkOwner parent models Foreign
  • CasperJS按类获取元素的innerHTML

    我是 CasperJS 的新手 在获取 innerHTML 时遇到一些问题 p class city Data I Need p 我尝试了一些东西 但似乎什么也没有得到 var city name casper evaluate class
  • Python AES 加密,无需额外模块

    是否可以在不安装额外模块的情况下使用 AES 加密 解密数据 我需要从以下位置发送 接收数据C 它是用System Security Cryptography参考 UPDATE我尝试过使用 PyAES 但它太旧了 我更新了一些东西以使其发挥
  • 如果已经选择了第一个,则从第二个选择中删除选项

    我正在尝试制作一个体育博彩页面 用户需要选择哪两支球队进行比赛 所以 我有两个selects 我需要删除一个option从第二个select 因为一个团队不能自己比赛 以下是精选内容
  • 函数的返回值存储在哪里

    我读过一些关于堆栈 堆以及它们在程序执行中如何使用的文章 Here http www c sharpcorner com UploadFile rmcochran csharp memory01122006130034PM csharp m
  • 文件权限;我的 www-folder 内容应该归 www-data 所有吗?

    这可能是一个菜鸟问题 但在任何地方都找不到答案 我有一个问题 另一个文件权限问题 https stackoverflow com questions 3483832 another file permissions problem已经帮助我
  • 用 Python 解析化学公式

    我正在尝试解决这个问题 https leetcode com articles number of atoms approach 1 recursion accepted https leetcode com articles number
  • python str.index 时间复杂度

    为了找到字符串中子字符串的位置 需要一个简单的算法O n 2 时间 然而 使用一些有效的算法 例如KMP算法 https en wikipedia org wiki Knuth E2 80 93Morris E2 80 93Pratt al
  • 在Python中组合多个音频文件(带延迟)

    我希望在 Python 中组合一系列不同的音频文件 mp3 要求之一是我需要能够在每个文件的末尾指定延迟 为了说明这一点 例如 文件1 mp3 3秒 延迟 2秒 文件2 mp3 mp3 3秒 延迟 2秒 mp3 4秒 延迟 2秒 file3
  • 窃取焦点,因为 SetForegroundWindow 无法做到这一点

    我知道这听起来很邪恶 但我的意图根本不是这个 用户单击 延迟拍摄 并开始倒计时 在此期间他们会聚焦另一个应用程序 然后倒计时后用户希望我的应用程序重新获得焦点 SetForegroundWindow当它从 PID X 的应用程序运行而 PI
  • 未找到类 ZMQContext

    我在 Ubuntu 14 04 的虚拟机内的 nginx 1 4 6 和 php 5 5 上运行 Web 服务器 并且需要安装 ZeroMQ 扩展 我已按照以下说明进行操作ZMQ http zeromq org area download
  • RIP寄存器不改变

    为什么当我继续使用c和内联汇编打印堆栈和指令指针寄存器时它们不会改变 因为逻辑上其他程序同时运行 所以它们应该在打印时不断改变 操作系统和 CPU 一起工作 为进程 同时运行 提供 CPU 切片 实际上 他们通过分配时间片来虚拟化 CPU
  • 如何在多行中编写 f 字符串而不引入意外的空格? [复制]

    这个问题在这里已经有答案了 考虑以下代码片段 name1 Nadya name2 Jim def print string string f name1 n name2 print string print string 产生 Nadya
  • Monodevelop - 仅使用 sudo 运行

    我已经在我的 Debian amd64 jessie 构建上安装了 Mono 和 Monodevelop 并且我只能使用提升的权限运行 monodevelop 从 UI startesque 菜单启动 monodevelop 似乎什么也没发
  • 带有位置参数的 Git 别名

    基本上我正在尝试别名 git files 9fa3 执行命令 git diff name status 9fa3 9fa3 但 git 似乎没有将位置参数传递给别名命令 我努力了 alias files git diff name stat
  • 为什么 Apache 没有在 XAMPP 上启动 [关闭]

    Closed 这个问题是无关 help closed questions 目前不接受答案 直到昨天 我的本地主机一切都很好 但从昨天开始 本地主机无法打开 它说 无法连接 我尝试了很多次来启动Apache on XAMPP 但它说消息忙 我
  • .NET .config 文件中 ConnectionString 元素的用途

    在中存储和读取应用程序的连接字符串有什么区别
  • 转移 PyPI 包的所有权

    As per PEP 541 https www python org dev peps pep 0541 现在可以认领废弃的 PyPI 项目 有人这样做过吗 联系谁 我尝试过dist utils 邮件列表 https mail pytho
  • Get-EventLog - 某些事件日志源缺少有效消息

    我正在使用 get eventlog 提取和过滤系统事件日志数据 我发现 get event log 无法正确返回与某些条目关联的消息 这些条目通常显示在事件日志查看器中 例如 get eventlog logname system sou