windows-event-log – 事件日志>过滤器当前日志> XML>
发布时间:2020-12-13 23:26:43 所属栏目:Windows 来源:网络整理
导读:我正在尝试在 Windows事件日志中搜索事件数据包含字符串TCP提供程序的任何内容,错误:0作为较长错误消息的一部分.为此,我创建了以下代码: QueryList Query Id="0" Path="Application" Select Path="Application"*[System[Provider[@Name='MyDemo' or @Name=
我正在尝试在
Windows事件日志中搜索事件数据包含字符串TCP提供程序的任何内容,错误:0作为较长错误消息的一部分.为此,我创建了以下代码:
<QueryList> <Query Id="0" Path="Application"> <Select Path="Application">*[System[Provider[@Name='MyDemo' or @Name='AnotherDemo'] and (Level=2 or Level=3)]][EventData[Data[contains(.,'TCP Provider,error: 0')]]]</Select> </Query> </QueryList> 然而,这被视为无效的查询 – 我猜测无法识别contains语句(因为它看起来像这里使用的XPath语法的特殊版本.有谁知道我正在尝试的是可能的/如何这样做呢? 提前致谢, JB
你总是可以使用powershell脚本并通过powershell的where函数传递XML(支持-contains -like -match):
nv.ps1 $Query = @" <QueryList> <Query Id="0" Path="System"> <Select Path="System"> *[System[(EventID=20001)]] </Select> </Query> </QueryList> "@ $events = Get-WinEvent -FilterXml $Query ForEach ($Event in $Events) { # Convert the event to XML $eventXML = [xml]$Event.ToXml() Add-Member -InputObject $Event -MemberType NoteProperty -Force -Name DriverVersion -Value $eventXML.Event.UserData.InstallDeviceID.DriverVersion Add-Member -InputObject $Event -MemberType NoteProperty -Force -Name DriverDescription -Value $eventXML.Event.UserData.InstallDeviceID.DriverDescription Add-Member -InputObject $Event -MemberType NoteProperty -Force -Name Data -Value $eventXML.Event.EventData.Data } $Events | Select TimeCreated,Id,DriverDescription,DriverVersion,ProviderName,@{Name="MessageData";Expression={$_.Message + $_.Data}} | Where {$_.DriverDescription -match "NVIDIA GeForce GTX*"} | Out-GridView pause 用于启动它的cmd(nv.cmd): powershell.exe -executionpolicy bypass "& '.nv.ps1'" (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- .net – 启动时完全隐藏WPF窗口?
- windows-xp – UNC快捷方式与映射网络驱动器
- group-policy – GPO静默软件部署
- windows – 一个线程可以调用SuspendThread传递自己的线程I
- window7利用Nexus搭建maven私有服务器
- win10安装CUDA CUDNN tensorflow-gpu
- windows-phone-7 – 如何在Windows Phone 7中获取Wi-Fi和移
- WPF:自定义窗口,标准最小/最大/关闭按钮
- windows – 从没有CGo的Go调用COM对象方法
- windows – 通过Citrix Receiver(或Citrix服务器)登录Citri
推荐文章
站长推荐
- windows-server-2008 – 大规模Active Directory
- Windows – PHP在IIS上占用了大量内存
- 我在哪里可以获得64位Windows转储中的当前滴答计
- windows-server-2008 – 您的系统管理员不允许使
- active-directory – 使用’netdom’命令验证Cro
- Microsoft的文件复制服务的开源替代方案[已关闭]
- windows – mklink到网络共享或UNC路径或映射驱动
- windows – git认为文件已经改变
- 在Windows更新10月2日之后,azure角色不会启动
- 将win32 MIDI SysEx应用程序移植到MacOSX
热点阅读