Dear All,
pretty new to powershell, might be a simple question, i'm trying to iterate a list of computers to find event logs and store them in an array, however if get-winevent fails for somereason, the next server in the list does not continue, please suggest.
foreach ($server in $servers){ if (test-connection $server -quiet)
{
$arr1+= Get-WinEvent -computername $server -MaxEvent 100 -FilterHashtable @{Logname="System"; ProviderName="Microsoft-Windows-WindowsUpdateClient"; ID=19,20;StartTime=(Get-Date).AddHours(-24)} |select Machinename,TimeCreated,ID,Message
}