首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >事件描述在Get中缺失,但出现在Descriptions和事件查看器中

事件描述在Get中缺失,但出现在Descriptions和事件查看器中
EN

Server Fault用户
提问于 2019-04-03 01:21:21
回答 1查看 2.3K关注 0票数 5

当我使用Get在powershell中查询事件日志事件时,缺少许多事件描述,但当我使用descriptions在powershell中查询它们或在常规事件查看器eventvwr.msc中查看它们时,它们就会出现。

以下是的输出:

代码语言:javascript
复制
PS U:\> Get-EventLog -LogName System -Source Microsoft-Windows-Kernel-Power

   Index Time          EntryType   Source                 InstanceID Message
   ----- ----          ---------   ------                 ---------- -------
   11985 Apr 02 13:42  Information Microsoft-Windows...          172 The description for Event ID '172' in Source 'Microsoft-Windo...
   11968 Apr 02 13:41  Information Microsoft-Windows...          109 The description for Event ID '109' in Source 'Microsoft-Windo...
   11732 Apr 02 09:41  Information Microsoft-Windows...          172 The description for Event ID '172' in Source 'Microsoft-Windo...
   11714 Apr 02 09:40  Information Microsoft-Windows...          109 The description for Event ID '109' in Source 'Microsoft-Windo...
   10363 Mar 29 14:28  Information Microsoft-Windows...          172 The description for Event ID '172' in Source 'Microsoft-Windo...
   10346 Mar 29 14:28  Information Microsoft-Windows...          109 The description for Event ID '109' in Source 'Microsoft-Windo...

以下是一个完整的活动:

代码语言:javascript
复制
PS U:\> Get-EventLog -LogName System -Source Microsoft-Windows-Kernel-Power | select -first 1 | fl


Index              : 11985
EntryType          : Information
InstanceId         : 172
Message            : The description for Event ID '172' in Source 'Microsoft-Windows-Kernel-Power' 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:'2', '6'
Category           : (203)
CategoryNumber     : 203
ReplacementStrings : {2, 6}
Source             : Microsoft-Windows-Kernel-Power
TimeGenerated      : 2019-04-02 13:42:01
TimeWritten        : 2019-04-02 13:42:01
UserName           : NT AUTHORITY\SYSTEM

以下是的输出:

代码语言:javascript
复制
PS C:\WINDOWS\system32> Get-WinEvent -LogName System -FilterXPath "
>>   
>>     *[System[Provider[@Name='Microsoft-Windows-Kernel-Power']]]
>>   
>> "


   ProviderName: Microsoft-Windows-Kernel-Power

TimeCreated                     Id LevelDisplayName Message
-----------                     -- ---------------- -------
2019-04-02 13:42:01            172 Information      Connectivity state in standby: Disconnected, Reason: NIC compliance
2019-04-02 13:41:44            109 Information      The kernel power manager has initiated a shutdown transition....
2019-04-02 09:41:08            172 Information      Connectivity state in standby: Disconnected, Reason: NIC compliance
2019-04-02 09:40:51            109 Information      The kernel power manager has initiated a shutdown transition....
2019-03-29 14:28:26            172 Information      Connectivity state in standby: Disconnected, Reason: NIC compliance
2019-03-29 14:28:09            109 Information      The kernel power manager has initiated a shutdown transition....

Get能够在没有问题的情况下呈现消息“处于备用状态的连接状态:断开连接,原因: NIC遵从性”。

下面是事件查看器中的第一个事件,消息也正确显示:

该消息表明注册表或事件消息dll文件可能是一个问题,但我检查了它们,但它们不是:

代码语言:javascript
复制
PS U:\> Get-ItemPropertyValue HKLM:\SYSTEM\CurrentControlSet\Services\EventLog\System\Microsoft-Windows-Kernel-Power -name EventMessageFile
C:\WINDOWS\system32\microsoft-windows-kernel-power-events.dll
PS U:\> test-path C:\WINDOWS\system32\microsoft-windows-kernel-power-events.dll
True
PS U:\> $handle = [System.IO.File]::OpenRead("C:\WINDOWS\system32\microsoft-windows-kernel-power-events.dll")
PS U:\> $handle.CanRead
True

这表明

  1. 源在注册表中进行配置。
  2. 该文件存在
  3. 我能读到文件

这并不是孤立于Microsoft内核电源。同样的情况也发生在许多其他事件源上。但并不是所有的事件来源。例如,Get-EventLog正确地呈现Microsoft Winlogon源消息:

代码语言:javascript
复制
PS U:\> Get-EventLog -LogName System -Source Microsoft-Windows-Winlogon | select -first 1 | ft

   Index Time          EntryType   Source                 InstanceID Message
   ----- ----          ---------   ------                 ---------- -------
   12100 Apr 02 13:58  Information Microsoft-Windows...         7001 User Logon Notification for Customer Experience Improvement P...

我已经多次重新启动我的机器,我运行了系统文件检查器,它没有报告任何问题。

版本详细信息:

代码语言:javascript
复制
PS U:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.17763.316
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.316
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
EN

回答 1

Server Fault用户

回答已采纳

发布于 2019-04-04 16:20:34

我相信您在Get cmdlet中遇到了一个限制,它已经被所取代。根据正式文件:

包含PowerShell名词的EventLog cmdlet仅在EventLog经典事件日志(如应用程序、系统或安全性)上工作。若要获取在Windows和以后的Windows版本中使用Windows事件日志技术的日志,请使用get。

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-eventlog?view=powershell-5.1

虽然您是在查询系统事件日志(在技术上不应受此影响),因为这是一个经典的事件日志,但是那些类型的事件日志条目(从Microsoft-Windows-开始)只开始出现在Vista和以后的版本中,所以我非常肯定这是“按设计”。

老实说,我不知道为什么您不只是使用Get-WinEvent cmdlet,因为它确实有效。

票数 3
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/961219

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档