【问题标题】:Get-Eventlog - To monitor specific event IDGet-Eventlog - 监控特定事件 ID
【发布时间】:2017-07-28 18:32:46
【问题描述】:

我需要监控特定工作站集的特定事件 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 字符:15 + ... $events = Get-EventLog -ComputerName $Workstation -LogName "Applica ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Get-EventLog], IOException + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.GetEventLogCommand

【问题讨论】:

    标签: get-eventlog event-id


    【解决方案1】:

    $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

    通过执行上述脚本,这不会产生任何错误,但会比平时花费更长的时间。 现在,任何过滤此选项并在短时间内提供输出的建议。非常感谢您的建议。

    【讨论】:

      猜你喜欢
      • 2019-02-06
      • 1970-01-01
      • 2020-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多