我需要监控特定工作站集的特定事件ID。 事件ID监视器:监视特定工作站集的特定事件ID
$Workstations = gc c:\NotBackedUp\Workstation.txt
foreach ($Workstation in $Workstations)
{
$events = Get-EventLog -ComputerName $Workstation -LogName "Application" | Where-Object {$_.EventID -eq "2"} | Format-List
}
$events >> C:\NotBackedUp\Test.txt
但我可以得到如下错误,
Get-EventLog:找不到网络路径。在行:6 char:15 + ... $ events = Get-EventLog -ComputerName $ Workstation -LogName“Applica ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ + CategoryInfo:NotSpecified:(:) [Get-EventLog],IOException + FullyQualifiedErrorId:System.IO.IOException,Microsoft.PowerShell.Commands.GetEventLogCommand
答案 0 :(得分:0)
$ Workstations = gc c:\ NotBackedUp \ Workstation.txt foreach($ Workstation中的$ Workstation) { $ events = Get-WinEvent -ComputerName $ Workstation -LogName“Application”| Where-Object {$ _.EventID -eq“2”} |格式列表 } $ events>> C:\ NotBackedUp \ Test.txt的
通过执行上述脚本,这不会产生任何错误,但需要比平时更长的时间。 现在,任何建议过滤此选项并在短时间内提供输出。您的建议非常感谢。