Powershell Get-WinEvent Xpath Query not valid



我会知道我的查询出了什么问题?

Get-WinEvent -LogName 'Application' -FilterXPath "/Event/System/Provider[@Name = 'My App']"

每次我得到以下异常:

*Get-WinEvent : La requête spécifiée n’est pas valide
Au caractère Ligne:1 : 1
+ Get-WinEvent -LogName 'Application' -FilterXPath "/Event/System/Provider[@Name = ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-WinEvent], EventLogException
    + FullyQualifiedErrorId : System.Diagnostics.Eventing.Reader.EventLogException,Microsoft.PowerShell.Commands.GetWinEventCommand*

在事件的 XML 代码下方

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
    <Provider Name="My App" /> 
    <EventID Qualifiers="49152">24</EventID> 
    <Level>2</Level> 
    <Task>0</Task> 
    <Keywords>0x80000000000000</Keywords> 
    <TimeCreated SystemTime="2017-10-12T08:43:57.000000000Z" /> 
    <EventRecordID>37160382</EventRecordID> 
    <Channel>Application</Channel> 
    <Computer>Apps.Server</Computer> 
    <Security /> 
</System>
<EventData>
    <Data>Some additional data</Data> 

提前非常感谢问候

删除事件前的"/"

Get-WinEvent -LogName 'Application' -FilterXPath "Event/System/Provider[@Name = 'My App']"
Get-WinEvent -LogName 'Application' -FilterXPath "Event/EventData/Data = '6.3.9600.18376'"

相关内容

  • 没有找到相关文章

最新更新