C# 读取事件日志

时间:2021-04-07 12:15:00

标签: c#

如何从事件日志中读取日志:

<块引用>

Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational

当我使用 EventLog.GetEventLogs() 时,我只得到日志:

  • ACEEventLog

  • 申请

  • 硬件事件

  • Internet Explorer

  • 管理服务

  • ODiag OSession

  • 安全

  • 系统

  • 视窗

  • PowerShell

1 个答案:

答案 0 :(得分:0)

作为解决方案,我使用了 EventLogQuery 和 EventLogSession。

但是,我有一个问题,如何使用下面的代码,但对于本地远程计算机的管理员。键入“.”、“”或“计算机名称”作为域没有帮助。遗漏会导致语法错误。

EventLogSession session = new EventLogSession( 
"ComputerName",            // Remote Computer 
"Domain",            //Domain 
"Admin",               // Username 
pw,
SessionAuthentication.Default);
相关问题