在C#中,有没有办法从事件查看器中读取AppLocker(位于Applications和Service Logs / Microsoft / Windows / Applocker)应用程序的安全事件?
EventLogWatcher无法订阅此应用程序的传入事件。
Iam面临的问题完全相同: Subscribe to Non System (Custom) Events in an Event Log
答案 0 :(得分:0)
https://docs.microsoft.com/en-us/previous-versions//aa385225(v=vs.85)
“ Microsoft-Windows-AppLocker / EXE和DLL”是一个通道
将EventLogWatcher
类用于频道中的catch事件
https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.eventing.reader.eventlogwatcher
C#示例:
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();
}
答案 1 :(得分:-1)
我将此添加为评论,但我没有代表。以下是我们用于在一些报告中获取这些事件的powershell。
Get-WinEvent“Microsoft-Windows-AppLocker / EXE和DLL”| Where-Object {$ .Id -eq 8003 -or $ .Id -eq 8004} | ForEach-Object {}