简体   繁体   English

如何使用 C# 获取事件查看器中所有提供程序的列表?

[英]How to get List of all Providers in Event Viewer using C#?

I would like to get all the provider names of Event Viewer using C#.我想使用 C# 获取事件查看器的所有提供程序名称。 Please see below the sample provider请参阅下面的示例提供程序

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
  <Provider Name="Microsoft-Team Foundation Server" Guid="{80761876-6844-47D5-8106-F8ED2AA8687B}" />!`<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
  <Provider Name="Microsoft-Team Foundation Server" Guid="{80761876-6844-47D5-8106-F8ED2AA8687B}" />

How can I get these providers list?如何获取这些提供商列表?

Use the EventLogSession.GetProviderNames method like this:像这样使用EventLogSession.GetProviderNames方法:

EventLogSession session = new EventLogSession();

var providers = session.GetProviderNames().ToList();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 C# 中获取所有 Windows 事件日志(事件查看器日志)及其层次结构和友好名称的列表 - How to get a list of all Windows Event Logs (Event Viewer Logs) with their hierarchy and friendly names in C# 通过 C# 获取所有 CSP 和/或 CNG 提供商的列表? - Get list of all CSP and/or CNG providers via C#? 如何使用C#将事件查看器日志导出到csv - How to export Event Viewer logs to csv using C# 使用c#从事件查看器中获取最新的Windows启动登录事件数据? - get the latest windows Startup Login event data from event viewer using c#? 如何使用 C# 获取 Active Directory 中所有域的列表 - How to get list of all domains in Active Directory using C# 如何在 C# 中使用 JobStorage 获取所有 Hangfire 作业的列表? - How to get List of all Hangfire Jobs using JobStorage in C#? 如何在C#中使用HttpClient获取所有重定向URL的列表 - How to get a list of all redirected URLs using HttpClient in C# 如何使用C#将所有元素放入Selenium的列表或字符串中? - How to get all elements into list or string with Selenium using C#? 如何使用C#在事件查看器中从失败的登录事件中读取IP地址? - How do I read the IP address from a failed logon event in the event viewer using C#? C# windows 事件查看器 - C# windows event viewer
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM