# get a list of all server names, maybe from AD, we'll assume it's in a variable called $serverlist
$eventIdToFind = "1234" # or whatever ID you're looking for
$logToSearch = "System"
foreach ($aServer in $serverlist) {
$theLog = New-Object System.Diagnostics.EventLog($logToSearch, $aServer)
$matchingEventList = $theLog.Entries | where { $_.EventId -eq $eventToFind }
if ($null -ne $machingEventList -and $matchingEventList.Count -gt 0) {
"Event Found on $aServer" # or do something else with it here
}
}
您可以使用 Eventlog to Syslog Service 实用程序或EventLog Inspector等软件将 Windows 事件日志事件广播到syslog 服务器。
您可以使用 PowerShell 搜索远程计算机上的事件日志,使用
System.Diagnostics.EventLog
. 假设您要查找的事件在系统日志中...