C# 从事件查看器读取AppLocker的安全事件
在C#中,是否有任何方法可以从事件查看器中读取AppLocker(位于Applications and Service Logs/Microsoft/Windows/AppLocker)应用程序的安全事件 EventLogWatcher无法订阅此应用程序的传入事件 我面临的问题与这里提到的完全相同:C# 从事件查看器读取AppLocker的安全事件,c#,C#,在C#中,是否有任何方法可以从事件查看器中读取AppLocker(位于Applications and Service Logs/Microsoft/Windows/AppLocker)应用程序的安全事件 EventLogWatcher无法订阅此应用程序的传入事件 我面临的问题与这里提到的完全相同: 我想添加此评论,但我没有代表。下面是我们在一些报告中用于获取这些事件的powershell 获取WinEvent“Microsoft Windows AppLocker/EXE和DLL”| 其中对象
我想添加此评论,但我没有代表。下面是我们在一些报告中用于获取这些事件的powershell 获取WinEvent“Microsoft Windows AppLocker/EXE和DLL”| 其中对象{$.Id-eq 8003-或$.Id-eq 8004}| ForEach对象{}
EventLogWatcher
在通道中捕获事件这项请求是为了用C#来阅读事件,而不是“答案”中所述的PowerShellAs。我没有代表对此发表评论,但我认为这可能与主题密切相关。
var bbb = new EventLogWatcher("Microsoft-Windows-AppLocker/EXE and DLL");
bbb.EventRecordWritten += Bbb_EventRecordWritten;
bbb.Enabled = true;
private void Bbb_EventRecordWritten(object sender, EventRecordWrittenEventArgs e)
{
var eventAsXml = e.EventRecord.ToXml();
var eventAsString = e.EventRecord.FormatDescription();
}