thanks, I try some scenarios and not capable use this examples
I try something like
$computer = Get-Content C:\temp\computer.txt foreach ($c in $computer) { if (Test-Connection -ComputerName $c -Count 1 -Quiet ) { Copy-Item C:\temp\AKANE.JPG -Destination \\$c\c$\ranma\ -ErrorAction SilentlyContinue -ErrorVariable copy_log } if ($copy_log) {Write-Output "On computer $c connection ok, but copy has fail" | out-file c:\temp\copy_log.txt } else { Write-Output "Computer $c is Offline" | Out-File C:\temp\connection_log.txt } }
The function copy its ok, but logs are going crazy.
its not working, is like -errorvariable put only the last computer on TXT logs.
thank you guys