[英]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.