How to add a computer name into object
can advise on how approach this? i have code works fine. $clients = (get-qadcomputer -searchroot "abc.forest.org/myou").name $range = (get-date) - (new-timespan -hour 48) $errors = @() foreach ($computer in $clients){ if (test-connection $computer -count 1 -erroraction silentlycontinue){ write-host $computer getting errors; $errors += get-winevent -ea silentlycontinue -computername $computer -filterhashtable @{logname="system"; level=1,2; starttime=$range} }else{ write-host $computer failed ping } } $errors lose computer error comes from. advice? so catch them in object: $el_errors+$clients = (get-qadcomputer -searchroot "abc.forest.org/myou").name $start=[datetime]::now.adddays(-2) $el_errors=$clients | foreach-object{ $computer=$_ if(test-connection $computer -count 1 -quiet){ write-host "$computer getting errors" get-winevent -ea silentlycontinue -computername $computer -filterhas...