I have requirement to monitor specific event ID for specific set of workstations. Event ID Monitor : To monitor Specific event ID for specific set of workstations
$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
But I can get error as below,
Get-EventLog : The network path was not found. At line:6 char:15 + ... $events = Get-EventLog -ComputerName $Workstation -LogName "Applica ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Get-EventLog], IOException + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.GetEventLogCommand
$Workstations = gc c:\NotBackedUp\Workstation.txt foreach ($Workstation in $Workstations) { $events = Get-WinEvent -ComputerName $Workstation -LogName "Application" | Where-Object {$_.EventID -eq "2"} | Format-List } $events >> C:\NotBackedUp\Test.txt
By doing above script, this will not give any error, but takes longer time than usual. Now, any suggestion to filter this option and give output in short time. Your suggestions are really appreciated.