我正在寻找使用 Powershell 来监视特定事件 ID 的 2003 和 08 服务器列表的“安全”日志。到目前为止,我已经使用了这个
$servers = gc c:\temp\servers.txt
foreach ($server in $servers)
{
$Query = "SELECT * FROM __instanceCreationEvent WHERE TargetInstancISA 'Win32_NTLogEvent' AND TargetInstance.LogFile = 'Security' AND TargetInstance.EventCode = '529' "
Register-WMIEvent -ComputerName $server -Query $Query -sourceIdentifier "$server" -Action
{Write-Host "The following Event ID of 529 has been found in the Security log on $server}
}
但是如何才能获得日志条目的时间戳,并且只有最新的时间戳(如果存在)?