Get-eventlog:如何使用powershell获取所有日志(应用程序,系统,安全性等)

Get-eventlog: How to get all Logs (Application, System, Security, etc) using powershell

我正在尝试使用Get-eventlog commandlet从EventLog读取所有日志文件

1
Get-EventLog -LogName Application, Security -after 09/15/2016 -Before 09/17/2016

我需要所有日志,例如Application,System,Security等,而不是-LogName Application。

有帮助吗?


您可以获取所有事件日志,如下所示:

1
(Get-WinEvent a€"ListLog * -ErrorAction SilentlyContinue).LogName

然后要么在它们之间循环以从每个日志中获取事件,要么尝试将整个数组作为-LogName传递,但是我可以想象在这种情况下性能损失将是巨大的。

此外,开发了Get-WinEvent来替代Get-EventLog,因此您可能要使用它。这是一些信息:http://blog.netwrix.com/2015/04/06/monitoring-event-logs-with-powershell/