如何获取“应用程序和服务日志”在C#中使用WMI查询的事件日志? [英] How to fetch "applications and services logs" event logs using WMI query in C#?

查看:295
本文介绍了如何获取“应用程序和服务日志”在C#中使用WMI查询的事件日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在使用获取应用程序事件日志,使用WMI QUERY在Windows Log下的系统事件日志如下所示

Hi All,

I am using Fetching Application event log, System event logs under the "Windows Log" using WMI QUERY as below

Select * From Win32_NTLogEvent Where Logfile ='Application'



现在我想获取在应用程序和服务日志下维护的日志,但是使用此查询我无法获取信息。



请帮忙写出正确的查询。

TIA



我尝试了什么:



i尝试了WMI查询。但是没有得到应用程序和服务事件日志的结果


now i want to fetch the logs which are maintaining under the "Applications and Services Logs" but using this query i am not able to fetch the information.

Please help to write correct query.
TIA

What I have tried:

i tried WMI query for this.but not getting the result for "Applications and Services" event logs

推荐答案

根据我在快速Google搜索中提出了几个来源,这些日志不会通过WMI公开。



您需要使用Powershell,wevutil或通过注册表以编程方式访问日志来提取它们。



PS部分有一个基本的钩子: Powershell和应用程序和服务日志 - 让IT知道 [ ^ ]
According to several sources that I came up with on a quick Google search, those logs are not exposed via WMI.

You'll need to either pull them using Powershell, wevutil, or programatically access the logs through the registry.

There's a basic hook for the PS portion at: Powershell and the Applications and Services Logs – Let IT know[^]


这篇关于如何获取“应用程序和服务日志”在C#中使用WMI查询的事件日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆